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
EntityTestViewGrantsCacheContext class Drupal\entity_test\Cache core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php Defines the entity_test view grants cache context service. 2
EntityTestViewsData class Drupal\entity_test core/modules/system/tests/modules/entity_test/src/EntityTestViewsData.php Provides a view to override views data for test entity types.
EntityTestViewsFieldAccessTest class Drupal\Tests\views\Kernel\Handler core/modules/views/tests/src/Kernel/Handler/EntityTestViewsFieldAccessTest.php Tests base field access in Views for the entity_test entity.
EntityTestWithBundle class Drupal\entity_test\Entity core/modules/system/tests/modules/entity_test/src/Entity/EntityTestWithBundle.php Defines the Test entity with bundle entity class. 4
EntityTestWithRevisionLog class Drupal\entity_test_revlog\Entity core/modules/system/tests/modules/entity_test_revlog/src/Entity/EntityTestWithRevisionLog.php Defines the test entity class. 2
EntityTestXmlAnonTest class Drupal\Tests\entity_test\Functional\Rest core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestXmlAnonTest.php @group rest
EntityTestXmlBasicAuthTest class Drupal\Tests\entity_test\Functional\Rest core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestXmlBasicAuthTest.php @group rest
EntityTestXmlCookieTest class Drupal\Tests\entity_test\Functional\Rest core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestXmlCookieTest.php @group rest
EntityTranslationFormTest class Drupal\Tests\system\Functional\Entity core/modules/system/tests/src/Functional/Entity/EntityTranslationFormTest.php Tests entity translation form.
EntityTranslationNormalizeTest class Drupal\Tests\hal\Kernel core/modules/hal/tests/src/Kernel/EntityTranslationNormalizeTest.php Tests that translated nodes are correctly (de-)normalized.
EntityTranslationRendererBase abstract class Drupal\views\Entity\Render core/modules/views/src/Entity/Render/EntityTranslationRendererBase.php Defines a base class for entity translation renderers. 3
EntityTranslationRenderTrait trait Drupal\views\Entity\Render core/modules/views/src/Entity/Render/EntityTranslationRenderTrait.php Trait used to instantiate the view's entity translation renderer. 6
EntityTranslationSettings class Drupal\content_translation\Plugin\migrate\source\d7 core/modules/content_translation/src/Plugin/migrate/source/d7/EntityTranslationSettings.php Drupal 7 Entity Translation settings from variables.
EntityTranslationSettingsTest class Drupal\Tests\content_translation\Kernel\Plugin\migrate\source\d7 core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d7/EntityTranslationSettingsTest.php Tests entity translation settings source plugin.
EntityTranslationTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php Tests entity translation functionality.
EntityType class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityType.php Provides an implementation of an entity type and its metadata. 2 12
EntityType class Drupal\Core\Entity\Annotation core/lib/Drupal/Core/Entity/Annotation/EntityType.php Defines an Entity type annotation object. 2
EntityTypeBundleInfo class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeBundleInfo.php Provides discovery and retrieval of entity type bundles. 1 2
EntityTypeBundleInfoInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeBundleInfoInterface.php Provides an interface for an entity type bundle info. 2 61
EntityTypeBundleInfoTest class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeBundleInfoTest.php @coversDefaultClass \Drupal\Core\Entity\EntityTypeBundleInfo @group Entity
EntityTypeConstraint class Drupal\Core\Entity\Plugin\Validation\Constraint core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityTypeConstraint.php Checks if a value is a valid entity type.
EntityTypeConstraintsTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintsTest.php Tests entity level validation constraints.
EntityTypeConstraintValidator class Drupal\Core\Entity\Plugin\Validation\Constraint core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityTypeConstraintValidator.php Validates the EntityType constraint.
EntityTypeConstraintValidatorTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php Tests validation constraints for EntityTypeConstraintValidator.
EntityTypedDataDefinitionTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php Tests deriving metadata of entity and field data types.
EntityTypeEvent class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeEvent.php Defines a base class for all entity type events. 1
EntityTypeEvents final class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeEvents.php Contains all events thrown while handling entity types. 3
EntityTypeEventSubscriberTrait trait Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeEventSubscriberTrait.php Helper methods for EntityTypeListenerInterface. 4
EntityTypeIdLengthException class Drupal\Core\Entity\Exception core/lib/Drupal/Core/Entity/Exception/EntityTypeIdLengthException.php Defines an exception thrown when an entity ID is too long. 1
EntityTypeInfo class Drupal\content_moderation core/modules/content_moderation/src/EntityTypeInfo.php Manipulates entity type information. 2
EntityTypeInfo class Drupal\workspaces core/modules/workspaces/src/EntityTypeInfo.php Manipulates entity type information. 1
EntityTypeInfoTest class Drupal\Tests\content_moderation\Kernel core/modules/content_moderation/tests/src/Kernel/EntityTypeInfoTest.php @coversDefaultClass \Drupal\content_moderation\EntityTypeInfo
EntityTypeInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeInterface.php Provides an interface for an entity type and its metadata. 3 216
EntityTypeListener class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeListener.php Reacts to entity type CRUD on behalf of the Entity system. 2
EntityTypeListenerInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeListenerInterface.php Defines an interface for reacting to entity type creation, deletion, and updates. 7 6
EntityTypeManager class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeManager.php Manages entity type plugin definitions. 1 4 2
EntityTypeManagerInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php Provides an interface for entity type managers. 2 344
EntityTypeManagerTest class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php @coversDefaultClass \Drupal\Core\Entity\EntityTypeManager @group Entity
EntityTypeManagerTestEntity abstract class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php Provides a content entity with dummy static method implementations.
EntityTypeRepository class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeRepository.php Provides helper methods for loading entity types. 1 2
EntityTypeRepositoryInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeRepositoryInterface.php Provides an interface for helper methods for loading entity types. 2 13
EntityTypeRepositoryTest class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeRepositoryTest.php @coversDefaultClass \Drupal\Core\Entity\EntityTypeRepository @group Entity
EntityTypeTest class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeTest.php @coversDefaultClass \Drupal\Core\Entity\EntityType @group Entity
EntityTypeWithoutLanguageFormTest class Drupal\Tests\language\Functional core/modules/language/tests/src/Functional/EntityTypeWithoutLanguageFormTest.php Tests entity type without language support.
EntityTypeWithoutViewsDataTest class Drupal\Tests\datetime_range\Kernel\Views core/modules/datetime_range/tests/src/Kernel/Views/EntityTypeWithoutViewsDataTest.php Tests datetime_range.module when an entity type provides no views data.
EntityUnitTest class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php @coversDefaultClass \Drupal\Core\Entity\Entity @group Entity @group Access
EntityUnitTestBase

in drupal:8.1.0 and is removed from drupal:9.0.0. Use \Drupal\KernelTests\Core\Entity\EntityKernelTestBase instead.

abstract class Drupal\system\Tests\Entity core/modules/system/src/Tests/Entity/EntityUnitTestBase.php Defines an abstract test base for entity unit tests.
EntityUntranslatableFieldsConstraint class Drupal\Core\Entity\Plugin\Validation\Constraint core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraint.php Validation constraint for the entity changed timestamp.
EntityUntranslatableFieldsConstraintValidator class Drupal\Core\Entity\Plugin\Validation\Constraint core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php Validates the EntityChanged constraint.
EntityUpdateAddRevisionDefaultTest class Drupal\Tests\system\Functional\Update core/modules/system/tests/src/Functional/Update/EntityUpdateAddRevisionDefaultTest.php Tests the upgrade path for adding the 'revision_default' field.

Other projects


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