Classes, traits, and interfaces - 8.9.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 1511

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
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\Unit core/modules/views/tests/src/Unit/EntityViewsDataTest.php @coversDefaultClass \Drupal\views\EntityViewsData @group Views
EntityViewsDataUpdateFilledTest class Drupal\Tests\views\Functional\Update core/modules/views/tests/src/Functional/Update/EntityViewsDataUpdateFilledTest.php Runs EntityViewsDataUpdateTest with a dump filled with content.
EntityViewsDataUpdateTest class Drupal\Tests\views\Functional\Update core/modules/views/tests/src/Functional/Update/EntityViewsDataUpdateTest.php Tests the upgrade path for views field plugins. 1
EntityViewsMultiValueBaseFieldDataUpdateTest class Drupal\Tests\views\Functional\Update core/modules/views/tests/src/Functional/Update/EntityViewsMultiValueBaseFieldDataUpdateTest.php Tests the upgrade path for views multi-value base field 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
EntityWithPluginCollectionInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityWithPluginCollectionInterface.php Provides an interface for an object using a plugin collection. 10 13
EntityWithUriCacheTagsTestBase

in drupal:8.6.0 and is removed from drupal:9.0.0. Use \Drupal\Tests\system\Functional\Entity\EntityWithUriCacheTagsTestBase.

abstract class Drupal\system\Tests\Entity core/modules/system/src/Tests/Entity/EntityWithUriCacheTagsTestBase.php Provides helper methods for Entity cache tags tests; for entities with URIs.
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. 6 6
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.
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.
Environment class Drupal\Component\Utility core/lib/Drupal/Component/Utility/Environment.php Provides PHP environment helper methods. 20
EnvironmentCleaner class Drupal\Core\Test core/lib/Drupal/Core/Test/EnvironmentCleaner.php Helper class for cleaning test environments. 1 2
EnvironmentCleanerFactory class Drupal\simpletest core/modules/simpletest/src/EnvironmentCleanerFactory.php Test environment cleaner factory. 2
EnvironmentCleanerInterface interface Drupal\Core\Test core/lib/Drupal/Core/Test/EnvironmentCleanerInterface.php Defines an interface for cleaning up test results and fixtures. 2 2
EnvironmentCleanerService class Drupal\simpletest core/modules/simpletest/src/EnvironmentCleanerService.php Uses containerized services to perform post-test cleanup. 2
EnvironmentCleanerTest class Drupal\KernelTests\Core\Test core/tests/Drupal/KernelTests/Core/Test/EnvironmentCleanerTest.php @coversDefaultClass \Drupal\Core\Test\EnvironmentCleaner @group Test
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
Error class Drupal\Core\Utility core/lib/Drupal/Core/Utility/Error.php Drupal error utility class. 14
ErrorCollection class Drupal\jsonapi\JsonApiResource core/modules/jsonapi/src/JsonApiResource/ErrorCollection.php To be used when the primary data is `errors`. 3
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
ErrorTest class Drupal\Tests\Core\Utility core/tests/Drupal/Tests/Core/Utility/ErrorTest.php @coversDefaultClass \Drupal\Core\Utility\Error @group Utility
ErrorTestController class Drupal\error_test\Controller core/modules/system/tests/modules/error_test/src/Controller/ErrorTestController.php Controller routines for error_test routes. 1
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 An event subscriber that does different things depending on whether classes exist. 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
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
ExceptionTestSiteSubscriber class Drupal\Core\EventSubscriber core/lib/Drupal/Core/EventSubscriber/ExceptionTestSiteSubscriber.php Custom handling of errors when in a system-under-test. 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

Other projects


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