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
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 226
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. 6 5
EntityTypeManager class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeManager.php Manages entity type plugin definitions. 1 7 2
EntityTypeManagerInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityTypeManagerInterface.php Provides an interface for entity type managers. 1 341
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. 1
EntityTypeManagerTestEntityBundle abstract class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php Provides a bundle specific class 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. 1 12
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
EntityTypeTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityTypeTest.php Tests general features of entity types.
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\EntityBase @group Entity @group Access
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.
EntityUpdateInitialTest class Drupal\Tests\system\Functional\UpdateSystem core/modules/system/tests/src/Functional/UpdateSystem/EntityUpdateInitialTest.php Tests handling of existing initial keys during updates.
EntityUpdateTest class Drupal\Tests\editor\Kernel core/modules/editor/tests/src/Kernel/EntityUpdateTest.php Tests updating an entity.
EntityUrlLanguageTest class Drupal\Tests\language\Kernel core/modules/language/tests/src/Kernel/EntityUrlLanguageTest.php Tests the language of entity URLs. @group language
EntityUrlTest class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php Tests URL handling of the \Drupal\Core\Entity\EntityBase class.
EntityUser class Drupal\user\Plugin\migrate\destination core/modules/user/src/Plugin/migrate/destination/EntityUser.php Provides a destination plugin for migrating user entities.
EntityUuidConverter class Drupal\jsonapi\ParamConverter core/modules/jsonapi/src/ParamConverter/EntityUuidConverter.php Parameter converter for upcasting entity UUIDs to full objects. 2
EntityUUIDTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityUUIDTest.php Tests creation, saving, and loading of entity UUIDs.
EntityValidationException class Drupal\migrate\Exception core/modules/migrate/src/Exception/EntityValidationException.php To throw when an entity generated during the import is not valid. 1
EntityValidationTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityValidationTest.php Tests the Entity Validation API.
EntityValidationTrait trait Drupal\jsonapi\Entity core/modules/jsonapi/src/Entity/EntityValidationTrait.php Provides a method to validate an entity. 2
EntityViewBuilder class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityViewBuilder.php Base class for entity view builders. 10 11
EntityViewBuilderInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityViewBuilderInterface.php Defines an interface for entity view builders. 1 2
EntityViewBuilderTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityViewBuilderTest.php Tests the entity view builder.
EntityViewController class Drupal\Core\Entity\Controller core/lib/Drupal/Core/Entity/Controller/EntityViewController.php Defines a generic controller to render a single entity. 2 2
EntityViewControllerTest class Drupal\Tests\system\Functional\Entity core/modules/system/tests/src/Functional/Entity/EntityViewControllerTest.php Tests EntityViewController functionality.
EntityViewDisplay class Drupal\Core\Entity\Entity core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php Configuration entity. 2 70
EntityViewDisplayAccessControlHandler class Drupal\Core\Entity\Entity\Access core/lib/Drupal/Core/Entity/Entity/Access/EntityViewDisplayAccessControlHandler.php Provides an entity access control handler for displays. 1
EntityViewDisplayAccessControlHandlerTest class Drupal\Tests\Core\Entity\Access core/tests/Drupal/Tests/Core/Entity/Access/EntityViewDisplayAccessControlHandlerTest.php @coversDefaultClass \Drupal\Core\Entity\Entity\Access\EntityViewDisplayAccessControlHandler @group Entity
EntityViewDisplayEditForm class Drupal\field_ui\Form core/modules/field_ui/src/Form/EntityViewDisplayEditForm.php Edit form for the EntityViewDisplay entity type. 2 3

Other projects


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