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
EntityViewModeXmlCookieTest class Drupal\FunctionalTests\Rest core/tests/Drupal/FunctionalTests/Rest/EntityViewModeXmlCookieTest.php Tests Entity View Mode Xml Cookie.
EntityViewsData class Drupal\views core/modules/views/src/EntityViewsData.php Provides generic views integration for entities. 8 25
EntityViewsDataInterface interface Drupal\views core/modules/views/src/EntityViewsDataInterface.php Provides an interface to integrate an entity type with views. 2 1
EntityViewsDataTest class Drupal\Tests\views\Kernel\Entity core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php Tests entity views data.
EntityViewsWithMultivalueBaseFieldTest class Drupal\Tests\views\Kernel\Entity core/modules/views/tests/src/Kernel/Entity/EntityViewsWithMultivalueBaseFieldTest.php Tests entity views with multivalue base fields.
EntityViewTrait trait Drupal\Tests core/tests/Drupal/Tests/EntityViewTrait.php Provides helper methods to deal with building entity views in tests. 5
EntityWithoutBaseTableTest class Drupal\Tests\views\Kernel core/modules/views/tests/src/Kernel/EntityWithoutBaseTableTest.php Tests field views data in an edge case scenario.
EntityWithPluginCollectionInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityWithPluginCollectionInterface.php Provides an interface for an object using a plugin collection. 10 14
EntityWithUriCacheTagsTestBase abstract class Drupal\Tests\system\Functional\Entity core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php Provides helper methods for Entity cache tags tests; for entities with URIs. 5 5
EntityWorkspaceConflictConstraint class Drupal\workspaces\Plugin\Validation\Constraint core/modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraint.php Validation constraint for an entity being edited in multiple workspaces. 1
EntityWorkspaceConflictConstraintValidator class Drupal\workspaces\Plugin\Validation\Constraint core/modules/workspaces/src/Plugin/Validation/Constraint/EntityWorkspaceConflictConstraintValidator.php Validates the EntityWorkspaceConflict constraint. 1
EntityWorkspaceConflictConstraintValidatorTest class Drupal\Tests\workspaces\Kernel core/modules/workspaces/tests/src/Kernel/EntityWorkspaceConflictConstraintValidatorTest.php Tests Drupal\workspaces\Plugin\Validation\Constraint\EntityWorkspaceConflictConstraintValidator.
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.

Other projects


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