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
EntryPoint class Drupal\jsonapi\Controller core/modules/jsonapi/src/Controller/EntryPoint.php Controller for the API entry point. 1
EntryPointTest class Drupal\Tests\jsonapi\Functional core/modules/jsonapi/tests/src/Functional/EntryPointTest.php Makes assertions about the JSON:API behavior for internal entities.
Enum final class Drupal\Component\Annotation\Doctrine\Annotation core/lib/Drupal/Component/Annotation/Doctrine/Annotation/Enum.php Annotation that can be used to signal to the parser to check the available values during the parsing process. 1
Environment class Drupal\Component\Utility core/lib/Drupal/Component/Utility/Environment.php Provides PHP environment helper methods. 16
EnvironmentCleaner class Drupal\Core\Test core/lib/Drupal/Core/Test/EnvironmentCleaner.php Helper class for cleaning test environments. 1
EnvironmentCleanerInterface interface Drupal\Core\Test core/lib/Drupal/Core/Test/EnvironmentCleanerInterface.php Defines an interface for cleaning up test results and fixtures. 1
EnvironmentCleanerTest class Drupal\KernelTests\Core\Test core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php Tests Drupal\Core\Test\EnvironmentCleaner.
EnvironmentSupportValidator final class Drupal\package_manager\Validator core/modules/package_manager/src/Validator/EnvironmentSupportValidator.php Checks that the environment has support for Package Manager. 1
EnvironmentSupportValidatorTest class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/EnvironmentSupportValidatorTest.php Tests Environment Support Validator.
EnvironmentTest class Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/EnvironmentTest.php Test PHP Environment helper methods.
Equality class Drupal\views\Plugin\views\filter core/modules/views/src/Plugin/views/filter/Equality.php Simple filter to handle equal to / not equal to filters.
EquivalentUpdate final class Drupal\Core\Update core/lib/Drupal/Core/Update/EquivalentUpdate.php Value object to hold information about an equivalent update. 3
EquivalentUpdateTest class Drupal\Tests\system\Functional\UpdateSystem core/modules/system/tests/src/Functional/UpdateSystem/EquivalentUpdateTest.php Tests that update hooks are properly run.
Error class Drupal\Core\Utility core/lib/Drupal/Core/Utility/Error.php Drupal error utility class. 32
ErrorCollection class Drupal\jsonapi\JsonApiResource core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php To be used when the primary data is `errors`. 4
ErrorContainer class Drupal\FunctionalTests\Bootstrap core/tests/Drupal/FunctionalTests/Bootstrap/ErrorContainer.php Container base class which triggers an error.
ErrorHandlerTest class Drupal\Tests\system\Functional\System core/modules/system/tests/src/Functional/System/ErrorHandlerTest.php Performs tests on the Drupal error and exception handler.
ErrorServiceTestServiceProvider class Drupal\error_service_test core/modules/system/tests/modules/error_service_test/src/ErrorServiceTestServiceProvider.php The service provider for testing bedlam in container rebuilds.
ErrorTest class Drupal\Tests\Core\Utility core/tests/Drupal/Tests/Core/Utility/ErrorTest.php Tests Drupal\Core\Utility\Error.
ErrorTestController class Drupal\error_test\Controller core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php Controller routines for error_test routes.
Event class Drupal\Component\EventDispatcher core/lib/Drupal/Component/EventDispatcher/Event.php Provides a forward-compatibility layer for the Symfony 5 event class. 31 34
EventBase class Drupal\migrate\Event core/modules/migrate/src/Event/EventBase.php Base class for migration events. 2 2
EventBaseTest class Drupal\Tests\migrate\Unit\Event core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php Tests Drupal\migrate\Event\EventBase. 2
EventException class Drupal\Core\Database\Exception core/lib/Drupal/Core/Database/Exception/EventException.php Exception thrown by the database event API. 2
EventLogSubscriber final class Drupal\package_manager_test_event_logger\EventSubscriber core/modules/package_manager/tests/modules/package_manager_test_event_logger/src/EventSubscriber/EventLogSubscriber.php Defines an event subscriber to test logging during events in Package Manager. 1 2
EventSubscriber class Drupal\config_collection_install_test core/modules/config/tests/config_collection_install_test/src/EventSubscriber.php Event subscriber for testing configuration collection. 2
EventSubscriber class Drupal\config_events_test core/modules/config/tests/config_events_test/src/EventSubscriber.php Event subscriber for testing configuration events. 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
EventSubscriber class Drupal\language_events_test core/modules/language/tests/language_events_test/src/EventSubscriber.php Event subscriber for testing Language events. 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\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
EventWithPackageListTrait trait Drupal\package_manager\Event core/modules/package_manager/src/Event/EventWithPackageListTrait.php Common methods for pre- and post-require events. 1
EventWithPackageListTraitTest class Drupal\Tests\package_manager\Unit core/modules/package_manager/tests/src/Unit/EventWithPackageListTraitTest.php Tests Event With Package List Trait.
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.
ExampleWithAttributeAndAnnotation class Drupal\plugin_test\Plugin\plugin_test\custom_annotation core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/custom_annotation/ExampleWithAttributeAndAnnotation.php Provides a test plugin with an annotation and attribute.
ExampleWithOtherModuleDependency class Drupal\plugin_test\Plugin\plugin_test\custom_annotation core/modules/system/tests/modules/plugin_test/src/Plugin/plugin_test/custom_annotation/ExampleWithOtherModuleDependency.php Test class with a dependency on another module.
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\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\mysqli\Driver\Database\mysqli core/modules/mysqli/src/Driver/Database/mysqli/ExceptionHandler.php MySQLi database exception handler class.
ExceptionHandler class Drupal\mysql\Driver\Database\mysql core/modules/mysql/src/Driver/Database/mysql/ExceptionHandler.php MySql database exception handler class. 1 1

Other projects


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