Classes, traits, and interfaces - 10.3.x - drupal

Primary tabs

Introduction to classes

A lot of the PHP code in Drupal is object oriented (OO), making use of PHP classes, interfaces, and traits. See the Objected-oriented programming conventions for more information.

See also

Objected-oriented programming conventions

File

core/core.api.php, line 1518

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
PhpUnitBridgeTest class Drupal\KernelTests\Core\Test core/tests/Drupal/KernelTests/Core/Test/PhpUnitBridgeTest.php Test how kernel tests interact with deprecation errors.
PhpUnitCliTest class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/PhpUnitCliTest.php @group TestSuites @group Test
PhpUnitTestDummyClass class Drupal\phpunit_test core/modules/system/tests/modules/phpunit_test/src/PhpUnitTestDummyClass.php
PhpUnitTestRunner class Drupal\Core\Test core/lib/Drupal/Core/Test/PhpUnitTestRunner.php Run PHPUnit-based tests. 2
PhpUnitTestRunnerTest class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php @coversDefaultClass \Drupal\Core\Test\PhpUnitTestRunner[[api-linebreak]] @group Test
PhpUnitWarnings trait Drupal\Tests\Traits core/tests/Drupal/Tests/Traits/PhpUnitWarnings.php Converts deprecation warnings added by PHPUnit to silenced deprecations. 12
PhpUnitWarningsTest class Drupal\Tests core/tests/Drupal/Tests/PhpUnitWarningsTest.php @coversDefaultClass \Drupal\Tests\Traits\PhpUnitWarnings[[api-linebreak]] @group legacy
PirateDayCacheabilityMetadataConfigOverride class Drupal\config_override_test core/modules/config/tests/config_override_test/src/PirateDayCacheabilityMetadataConfigOverride.php Test implementation of a config override that provides cacheability metadata. 2
PirateDayCacheContext class Drupal\config_override_test\Cache core/modules/config/tests/config_override_test/src/Cache/PirateDayCacheContext.php Defines the PirateDayCacheContext service that allows to cache the booty. 2 2
PlaceholderGenerator class Drupal\Core\Render core/lib/Drupal/Core/Render/PlaceholderGenerator.php Turns a render array into a placeholder. 1 2
PlaceholderGeneratorInterface interface Drupal\Core\Render core/lib/Drupal/Core/Render/PlaceholderGeneratorInterface.php Defines an interface for turning a render array into a placeholder. 1 1
PlaceholderGeneratorTest class Drupal\Tests\Core\Render core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php @coversDefaultClass \Drupal\Core\Render\PlaceholderGenerator[[api-linebreak]] @group Render
PlaceholderingRenderCache class Drupal\Core\Render core/lib/Drupal/Core/Render/PlaceholderingRenderCache.php Adds automatic placeholdering to the RenderCache. 1 2 2
PlaceholderInterface interface Drupal\Core\Database\Query core/lib/Drupal/Core/Database/Query/PlaceholderInterface.php Interface for a query that accepts placeholders. 3 2
PlaceholderMessageTest class Drupal\Tests\system\Functional\Render core/modules/system/tests/src/Functional/Render/PlaceholderMessageTest.php Functional test verifying that messages set in placeholders always appear.
PlaceholdersTest class Drupal\Tests\Core\Render core/tests/Drupal/Tests/Core/Render/RendererTestBase.php
PlaceholderStrategyInterface interface Drupal\Core\Render\Placeholder core/lib/Drupal/Core/Render/Placeholder/PlaceholderStrategyInterface.php Provides an interface for defining a placeholder strategy service. 3 2
PlainTextOutput class Drupal\Component\Render core/lib/Drupal/Component/Render/PlainTextOutput.php Provides an output strategy for transforming HTML into simple plain text. 20
PlainTextOutputTest class Drupal\Tests\Component\Render core/tests/Drupal/Tests/Component/Render/PlainTextOutputTest.php @coversDefaultClass \Drupal\Component\Render\PlainTextOutput[[api-linebreak]] @group Utility
Plugin class Drupal\Component\Annotation core/lib/Drupal/Component/Annotation/Plugin.php Defines a Plugin annotation object. 42 41
Plugin class Drupal\Component\Plugin\Attribute core/lib/Drupal/Component/Plugin/Attribute/Plugin.php Defines a Plugin attribute object. 52 55
Plugin class Drupal\Composer\Plugin\Scaffold composer/Plugin/Scaffold/Plugin.php Composer plugin for handling drupal scaffold.
PluginAlterTest class Drupal\KernelTests\Core\Render\Element core/tests/Drupal/KernelTests/Core/Render/Element/PluginAlterTest.php @group Render
PluginAwareInterface interface Drupal\Component\Plugin core/lib/Drupal/Component/Plugin/PluginAwareInterface.php Provides an interface for objects that depend on a plugin. 4 6
PluginBase abstract class Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginBase.php Base class for plugins supporting metadata inspection and translation. 47 45
PluginBase abstract class Drupal\Component\Plugin core/lib/Drupal/Component/Plugin/PluginBase.php Base class for plugins wishing to support metadata inspection. 14 28
PluginBase abstract class Drupal\views\Plugin\views core/modules/views/src/Plugin/views/PluginBase.php Base class for any views plugin types. 15 20
PluginBaseTest class Drupal\Tests\Component\Plugin core/tests/Drupal/Tests/Component/Plugin/PluginBaseTest.php @coversDefaultClass \Drupal\Component\Plugin\PluginBase[[api-linebreak]] @group Plugin
PluginBaseTest class Drupal\Tests\views\Unit core/modules/views/tests/src/Unit/PluginBaseTest.php @coversDefaultClass \Drupal\views\Plugin\views\PluginBase[[api-linebreak]] @group views
PluginBaseTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php Tests the PluginBase class.
PluginDefinition class Drupal\Component\Plugin\Definition core/lib/Drupal/Component/Plugin/Definition/PluginDefinition.php Provides object-based plugin definitions. 9 9
PluginDefinitionInterface interface Drupal\Component\Plugin\Definition core/lib/Drupal/Component/Plugin/Definition/PluginDefinitionInterface.php Defines a plugin definition. 6 8
PluginDependencyTrait trait Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php Provides a trait for calculating the dependencies of a plugin. 5
PluginDependencyTraitTest class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php @coversDefaultClass \Drupal\Core\Plugin\PluginDependencyTrait[[api-linebreak]] @group Plugin
PluginEventSubscriber class Drupal\migrate\Plugin core/modules/migrate/src/Plugin/PluginEventSubscriber.php Event subscriber to forward Migrate events to source and destination plugins. 2
PluginExample class Drupal\plugin_test\Plugin\Attribute core/modules/system/tests/modules/plugin_test/src/Plugin/Attribute/PluginExample.php Defines a custom PluginExample attribute. 2
PluginExample class Drupal\plugin_test\Plugin\Annotation core/modules/system/tests/modules/plugin_test/src/Plugin/Annotation/PluginExample.php Defines a custom Plugin annotation. 1
PluginException class Drupal\Component\Plugin\Exception core/lib/Drupal/Component/Plugin/Exception/PluginException.php Base class for plugin exceptions. 3 24
PluginExistsConstraint class Drupal\Core\Plugin\Plugin\Validation\Constraint core/lib/Drupal/Core/Plugin/Plugin/Validation/Constraint/PluginExistsConstraint.php Checks if a plugin exists and optionally implements a particular interface. 1
PluginExistsConstraintTest class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/PluginExistsConstraintTest.php @group Plugin @group Validation
PluginExistsConstraintValidator class Drupal\Core\Plugin\Plugin\Validation\Constraint core/lib/Drupal/Core/Plugin/Plugin/Validation/Constraint/PluginExistsConstraintValidator.php Validates the PluginExists constraint.
PluginExistsConstraintValidatorTest class Drupal\KernelTests\Core\Plugin core/tests/Drupal/KernelTests/Core/Plugin/PluginExistsConstraintValidatorTest.php @group Plugin @group Validation
PluginExtended class Drupal\plugin_test_extended\Plugin\Annotation core/modules/system/tests/modules/plugin_test_extended/src/Plugin/Annotation/PluginExtended.php Defines a test annotation that extends an annotation in another namespace.
PluginFormBase abstract class Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginFormBase.php Provides a base class for plugin forms. 4 4
PluginFormFactory class Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginFormFactory.php Provides form discovery capabilities for plugins. 1 2
PluginFormFactoryInterface interface Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginFormFactoryInterface.php Provides an interface for retrieving form objects for plugins. 1 9
PluginFormFactoryTest class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php @coversDefaultClass \Drupal\Core\Plugin\PluginFormFactory[[api-linebreak]] @group Plugin
PluginFormInterface interface Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginFormInterface.php Provides an interface for an embeddable plugin form. 21 27
PluginHelper

in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, use instanceof() to check for \Drupal\Component\Plugin\ConfigurableInterface.

class Drupal\Component\Plugin core/lib/Drupal/Component/Plugin/PluginHelper.php A helper class to determine if a plugin is configurable. 1
PluginHelperLegacyTest class Drupal\Tests\Component\Plugin core/tests/Drupal/Tests/Component/Plugin/PluginHelperLegacyTest.php @coversDefaultClass \Drupal\Component\Plugin\PluginHelper[[api-linebreak]] @group Plugin @group legacy

Other projects


Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.