Classes, traits, and interfaces - 9.5.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 1523

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
ErrorTestController class Drupal\error_test\Controller core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php Controller routines for error_test routes. 1
Event class Drupal\Component\EventDispatcher core/lib/Drupal/Component/EventDispatcher/Event.php Provides a forward-compatibility layer for the Symfony 5 event class. 27 31
EventBase class Drupal\migrate\Event core/modules/migrate/src/Event/EventBase.php 2 2
EventBaseTest class Drupal\Tests\migrate\Unit\Event core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php @coversDefaultClass \Drupal\migrate\Event\EventBase @group migrate 2
EventSubscriber class Drupal\module_install_class_loader_test2 core/modules/system/tests/modules/module_install_class_loader_test2/src/EventSubscriber.php An event subscriber that does nothing. 2
EventSubscriber class Drupal\module_install_class_loader_test1 core/modules/system/tests/modules/module_install_class_loader_test1/src/EventSubscriber.php Defines an event subscriber that conditionally unsets the event list. 2
EventSubscriber class Drupal\config_collection_install_test core/modules/config/tests/config_collection_install_test/src/EventSubscriber.php 2
EventSubscriber class Drupal\config_events_test core/modules/config/tests/config_events_test/src/EventSubscriber.php 2
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.
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 class Drupal\corefake\Driver\Database\corefakeWithAllCustomClasses core/tests/fixtures/database_drivers/module/corefake/src/Driver/Database/corefakeWithAllCustomClasses/ExceptionHandler.php CorefakeWithAllCustomClasses implementation of \Drupal\Core\Database\ExceptionHandler.
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 2
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 @group EventSubscriber
ExceptionLoggingSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php Log exceptions without further handling. 2
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\TypedData\Validation core/lib/Drupal/Core/TypedData/Validation/ExecutionContext.php Defines an execution context class. 1
ExecutionContextFactory class Drupal\Core\TypedData\Validation core/lib/Drupal/Core/TypedData/Validation/ExecutionContextFactory.php Defines an execution factory for the Typed Data validator. 2
ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest class Drupal\FunctionalTests core/tests/Drupal/FunctionalTests/ExistingDrupal8StyleDatabaseConnectionInSettingsPhpTest.php @group Database
ExpectDeprecationTest class Drupal\Tests core/tests/Drupal/Tests/ExpectDeprecationTest.php @coversDefaultClass \Drupal\Tests\Traits\ExpectDeprecationTrait
ExpectDeprecationTrait

in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait instead.

trait Drupal\Tests\Traits core/tests/Drupal/Tests/Traits/ExpectDeprecationTrait.php Adds the ability to dynamically set expected deprecation messages in tests. 2
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

Other projects


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