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
EventSubscriber class Drupal\config_transformer_test core/modules/config/tests/config_transformer_test/src/EventSubscriber.php Class EventSubscriber. 2
EventSubscriber class Drupal\config_import_test core/modules/config/tests/config_import_test/src/EventSubscriber.php Config import subscriber for config import events. 2
Example1 class Drupal\plugin_test\Plugin\plugin_test\custom_annotation core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/custom_annotation/Example1.php Provides a test plugin with a custom annotation.
Example2 class Drupal\plugin_test\Plugin\plugin_test\custom_annotation core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/custom_annotation/Example2.php Provides a test plugin with a custom annotation.
Example3 class Drupal\plugin_test\Plugin\plugin_test\custom_annotation core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/custom_annotation/Example3.php Provides a test plugin with a custom attribute.
Example4 class Drupal\plugin_test\Plugin\plugin_test\custom_annotation core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/custom_annotation/Example4.php Provides a test plugin with a custom attribute.
Example5 class Drupal\plugin_test\Plugin\plugin_test\custom_annotation core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/custom_annotation/Example5.php Provides a test plugin with a custom attribute.
ExampleAttribute final class Drupal\Tests\Component\Annotation\Doctrine\Fixtures\ExtraAttributes core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/ExtraAttributes/ExampleAttribute.php #[\Attribute] 2
ExampleParentAttribute class Drupal\Tests\Component\Annotation\Doctrine\Fixtures\ExtraAttributes core/tests/Drupal/Tests/Component/Annotation/Doctrine/Fixtures/ExtraAttributes/ExampleParentAttribute.php #[\Attribute] 1
ExampleRenderable class Drupal\twig_theme_test core/modules/system/tests/modules/twig_theme_test/src/ExampleRenderable.php Provides an example implementation of the RenderableInterface.
ExceptionContainer class Drupal\FunctionalTests\Bootstrap core/tests/Drupal/FunctionalTests/Bootstrap/ExceptionContainer.php Base container which throws an exception.
ExceptionDetectNeedsInstallSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/ExceptionDetectNeedsInstallSubscriber.php Exception handler to determine if an exception indicates an uninstalled site. 2
ExceptionHandler

in drupal:9.4.0 and is removed from drupal:11.0.0. The MySQL database driver has been moved to the mysql module.

class Drupal\Core\Database\Driver\mysql core/lib/Drupal/Core/Database/Driver/mysql/ExceptionHandler.php MySql database exception handler class. 1
ExceptionHandler class Drupal\Core\Database core/lib/Drupal/Core/Database/ExceptionHandler.php Base Database exception handler class. 2 6
ExceptionHandler class Drupal\core_fake\Driver\Database\CoreFakeWithAllCustomClasses core/tests/fixtures/database_drivers/module/core_fake/src/Driver/Database/CoreFakeWithAllCustomClasses/ExceptionHandler.php CoreFakeWithAllCustomClasses implementation of \Drupal\Core\Database\ExceptionHandler.
ExceptionHandler class Drupal\mysql\Driver\Database\mysql core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php MySql database exception handler class. 1 1
ExceptionHandlingTest class Drupal\KernelTests\Core\Routing core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php Tests the exception handling for various cases.
ExceptionInterface interface Drupal\Component\Plugin\Exception core/lib/Drupal/Component/Plugin/Exception/ExceptionInterface.php Exception interface for all exceptions thrown by the Plugin component. 5 2
ExceptionJsonSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php Default handling for JSON errors. 1 2
ExceptionJsonSubscriberTest class Drupal\Tests\Core\EventSubscriber core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php @coversDefaultClass \Drupal\Core\EventSubscriber\ExceptionJsonSubscriber[[api-linebreak]] @group EventSubscriber
ExceptionLoggingSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php Log exceptions without further handling. 2
ExceptionLoggingSubscriberTest class Drupal\KernelTests\Core\EventSubscriber core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php Tests that HTTP exceptions are logged correctly.
ExcludedFieldTokenTest class Drupal\Tests\rest\Functional\Views core/modules/rest/tests/src/Functional/Views/ExcludedFieldTokenTest.php Tests the display of an excluded field that is used as a token.
ExcludedModulesEventSubscriber final class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/ExcludedModulesEventSubscriber.php The event subscriber preventing excluded modules to be exported. 2
ExcludedModulesEventSubscriberTest class Drupal\KernelTests\Core\Config core/tests/Drupal/KernelTests/Core/Config/ExcludedModulesEventSubscriberTest.php Tests ExcludedModulesEventSubscriber.
ExecTrait trait Drupal\Tests\Composer\Plugin\Scaffold core/tests/Drupal/Tests/Composer/Plugin/Scaffold/ExecTrait.php Convenience class for creating fixtures. 3
ExecutableException class Drupal\Core\Executable core/lib/Drupal/Core/Executable/ExecutableException.php Generic executable plugin exception class. 1
ExecutableInterface interface Drupal\Core\Executable core/lib/Drupal/Core/Executable/ExecutableInterface.php An interface for executable plugins. 3 3
ExecutableManagerInterface interface Drupal\Core\Executable core/lib/Drupal/Core/Executable/ExecutableManagerInterface.php An interface for managers of executable plugins. 1 4
ExecutablePluginBase abstract class Drupal\Core\Executable core/lib/Drupal/Core/Executable/ExecutablePluginBase.php Provides the basic architecture for executable plugins. 1 1
ExecuteMigration class Drupal\migrate_no_migrate_drupal_test\Controller core/modules/migrate/tests/modules/migrate_no_migrate_drupal_test/src/Controller/ExecuteMigration.php Custom controller to execute the test migrations.
ExecutionContext class Drupal\Core\Validation core/lib/Drupal/Core/Validation/ExecutionContext.php Defines an execution context class. 1 2
ExecutionContext class Drupal\Core\TypedData\Validation core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php Defines an execution context class.
ExecutionContextFactory class Drupal\Core\TypedData\Validation core/lib/Drupal/Core/TypedData/Validation/ExecutionContextFactory.php Defines an execution factory for the Typed Data validator.
ExecutionContextFactory class Drupal\Core\Validation core/lib/Drupal/Core/Validation/ExecutionContextFactory.php Defines an execution factory for the Symfony validator. 1 4
ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest class Drupal\FunctionalTests core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php @group Database
ExpectDeprecationTest class Drupal\Tests core/tests/Drupal/Tests/ExpectDeprecationTest.php Ensures Drupal has test coverage of Symfony's deprecation testing.
ExperimentalHelpTest class Drupal\Tests\help\Functional core/modules/help/tests/src/Functional/ExperimentalHelpTest.php Verifies help for experimental modules.
ExperimentalThemeTest class Drupal\Tests\system\Functional\Theme core/modules/system/tests/src/Functional/Theme/ExperimentalThemeTest.php Tests the installation of experimental themes.
Explode class Drupal\migrate\Plugin\migrate\process core/modules/migrate/src/Plugin/migrate/process/Explode.php Splits the source string into an array of strings, using a delimiter. 1
ExplodeTest class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/ExplodeTest.php Tests the Explode process plugin.
ExportForm class Drupal\locale\Form core/modules/locale/src/Form/ExportForm.php Form for the Gettext translation files export form. 1
ExportStorageManager final class Drupal\Core\Config core/lib/Drupal/Core/Config/ExportStorageManager.php The export storage manager dispatches an event for the export storage. 1 2
ExportStorageManagerTest class Drupal\KernelTests\Core\Config core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php Tests the export storage manager.
ExposedFilterAJAXTest class Drupal\Tests\views\FunctionalJavascript core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php Tests the basic AJAX functionality of Views exposed forms.
ExposedFormCache class Drupal\views core/modules/views/src/ExposedFormCache.php Caches exposed forms, as they are heavy to generate. 1 2
ExposedFormCheckboxesTest class Drupal\Tests\views\Functional\Plugin core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php Tests exposed forms functionality.
ExposedFormPluginBase abstract class Drupal\views\Plugin\views\exposed_form core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php Base class for Views exposed filter form plugins. 2
ExposedFormPluginInterface interface Drupal\views\Plugin\views\exposed_form core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginInterface.php Interface for exposed filter form plugins. 1 1 1
ExposedFormRenderTest class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php Tests the exposed form.

Other projects


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