Classes, traits, and interfaces - main - 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 1529

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
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 Tests Drupal\Core\Plugin\PluginDependencyTrait.
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. 6
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. 2
PluginExistsConstraintTest class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/PluginExistsConstraintTest.php Tests Drupal\Core\Plugin\Plugin\Validation\Constraint\PluginExistsConstraint.
PluginExistsConstraintValidator class Drupal\Core\Plugin\Plugin\Validation\Constraint core/lib/Drupal/Core/Plugin/Plugin/Validation/Constraint/PluginExistsConstraintValidator.php Validates the PluginExists constraint. 1
PluginExistsConstraintValidatorTest class Drupal\KernelTests\Core\Plugin core/tests/Drupal/KernelTests/Core/Plugin/PluginExistsConstraintValidatorTest.php Tests Plugin Exists Constraint Validator.
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. 7 7
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 10
PluginFormFactoryTest class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/PluginFormFactoryTest.php Tests Drupal\Core\Plugin\PluginFormFactory.
PluginFormInterface interface Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginFormInterface.php Provides an interface for an embeddable plugin form. 23 28
PluginID class Drupal\Component\Annotation core/lib/Drupal/Component/Annotation/PluginID.php Defines a Plugin annotation object that just contains an ID. 2 3
PluginID class Drupal\Component\Plugin\Attribute core/lib/Drupal/Component/Plugin/Attribute/PluginID.php Defines a Plugin attribute object that just contains an ID. 6 12
PluginIdTest class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/PluginIdTest.php Tests Drupal\Component\Annotation\PluginID.
PluginIdTest class Drupal\Tests\Component\Plugin\Attribute core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginIdTest.php Tests Drupal\Component\Plugin\Attribute\PluginID.
PluginInspectionInterface interface Drupal\Component\Plugin core/lib/Drupal/Component/Plugin/PluginInspectionInterface.php Plugin interface for providing some metadata inspection. 32 43
PluginInstanceTest class Drupal\Tests\views\Kernel core/modules/views/tests/src/Kernel/PluginInstanceTest.php Tests that an instance of all views plugins can be created.
PluginKernelTestBase abstract class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/PluginKernelTestBase.php Base test class for views plugin unit tests. 4
PluginManager class Drupal\lazy_route_provider_install_test core/modules/system/tests/modules/lazy_route_provider_install_test/src/PluginManager.php Plugin manager for testing the lazy route provider during module install. 2
PluginManagerBase abstract class Drupal\Component\Plugin core/lib/Drupal/Component/Plugin/PluginManagerBase.php Base class for plugin managers. 7 9
PluginManagerBaseTest class Drupal\Tests\Component\Plugin core/tests/Drupal/Tests/Component/Plugin/PluginManagerBaseTest.php Tests Drupal\Component\Plugin\PluginManagerBase.
PluginManagerCacheClearer class Drupal\module_test core/modules/system/tests/modules/module_test/src/PluginManagerCacheClearer.php Helps test module uninstall. 1 2
PluginManagerDependentValidatorTrait trait Drupal\ckeditor5\Plugin\Validation\Constraint core/modules/ckeditor5/src/Plugin/Validation/Constraint/PluginManagerDependentValidatorTrait.php Common functionality for many CKEditor 5 validation constraints.
PluginManagerInterface interface Drupal\Component\Plugin core/lib/Drupal/Component/Plugin/PluginManagerInterface.php Interface implemented by plugin managers. 21 49
PluginManagerPass class Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginManagerPass.php Registers plugin managers to the plugin.cache_clearer service. 1
PluginNotFoundException class Drupal\Component\Plugin\Exception core/lib/Drupal/Component/Plugin/Exception/PluginNotFoundException.php Plugin exception class to be thrown when a plugin ID could not be found. 59
PluginSettingsBase abstract class Drupal\Core\Field core/lib/Drupal/Core/Field/PluginSettingsBase.php Base class for the Field API plugins. 3 1
PluginSettingsBaseTest class Drupal\Tests\Core\Field core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php Tests Drupal\Core\Field\PluginSettingsBase.
PluginSettingsInterface interface Drupal\Core\Field core/lib/Drupal/Core/Field/PluginSettingsInterface.php Interface definition for plugin with settings. 3 3
PluginStub class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/PluginTest.php
PluginStub class Drupal\Tests\Component\Plugin\Attribute core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php
PluginTest class Drupal\Tests\Component\Annotation core/tests/Drupal/Tests/Component/Annotation/PluginTest.php Tests Drupal\Component\Annotation\Plugin.
PluginTest class Drupal\Tests\Component\Plugin\Attribute core/tests/Drupal/Tests/Component/Plugin/Attribute/PluginTest.php Tests Drupal\Component\Plugin\Attribute\Plugin.
PluginTestBase abstract class Drupal\KernelTests\Core\Plugin core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php Base class for Plugin API unit tests. 3
PluginTestHooks class Drupal\plugin_test\Hook core/modules/system/tests/modules/plugin_test/src/Hook/PluginTestHooks.php Hook implementations for plugin_test.
PluginTypeListTest class Drupal\Tests\views\Unit core/modules/views/tests/src/Unit/PluginTypeListTest.php Tests that list of plugin is correct.
PluginWithFormsInterface interface Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginWithFormsInterface.php Provides an interface for plugins which have forms. 6 14
PluginWithFormsTrait trait Drupal\Core\Plugin core/lib/Drupal/Core/Plugin/PluginWithFormsTrait.php Provides a trait with typical behavior for plugins which have forms. 5
PluginWithFormsTraitTest class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php Tests Drupal\Core\Plugin\PluginWithFormsTrait.
PluralFormula class Drupal\locale core/modules/locale/src/PluralFormula.php Manages the storage of plural formula per language in state. 2
PluralFormulaInterface interface Drupal\locale core/modules/locale/src/PluralFormulaInterface.php An interface for a service providing plural formulae. 1
PluralTranslatableMarkup class Drupal\Core\StringTranslation core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php A class to hold plural translatable markup. 17
PluralTranslatableMarkupTest class Drupal\Tests\Core\StringTranslation core/tests/Drupal/Tests/Core/StringTranslation/PluralTranslatableMarkupTest.php Tests the TranslatableMarkup class.
PluralTranslation class Drupal\Core\Annotation core/lib/Drupal/Core/Annotation/PluralTranslation.php Defines an annotation object for strings that require plural forms. 1
PluralTranslationTest class Drupal\Tests\Core\Annotation core/tests/Drupal/Tests/Core/Annotation/PluralTranslationTest.php Tests Drupal\Core\Annotation\PluralTranslation.

Other projects


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