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
EntityReferenceAutocompleteWidgetTest class Drupal\FunctionalJavascriptTests\EntityReference core/tests/Drupal/FunctionalJavascriptTests/EntityReference/EntityReferenceAutocompleteWidgetTest.php Tests the output of entity reference autocomplete widgets.
EntityReferenceAutoCreateTest class Drupal\Tests\field\Functional\EntityReference core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAutoCreateTest.php Tests creating new entity (e.g. taxonomy-term) from an autocomplete widget.
EntityReferenceEntityFormatter class Drupal\Core\Field\Plugin\Field\FieldFormatter core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceEntityFormatter.php Plugin implementation of the 'entity reference rendered entity' formatter. 2
EntityReferenceFieldAttributesTest class Drupal\Tests\rdf\Functional core/modules/rdf/tests/src/Functional/EntityReferenceFieldAttributesTest.php Tests RDFa markup generation for taxonomy term fields.
EntityReferenceFieldDefaultValueTest class Drupal\Tests\field\Functional\EntityReference core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldDefaultValueTest.php Tests entity reference field default values storage in CMI.
EntityReferenceFieldItemList class Drupal\Core\Field core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php Defines a item list class for entity reference fields. 2 2
EntityReferenceFieldItemListInterface interface Drupal\Core\Field core/lib/Drupal/Core/Field/EntityReferenceFieldItemListInterface.php Interface for entity reference lists of field items. 1 8
EntityReferenceFieldItemNormalizer class Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizer.php Adds the file URI to embedded file entities. 1 2
EntityReferenceFieldItemNormalizerTest class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/EntityReferenceFieldItemNormalizerTest.php @coversDefaultClass \Drupal\serialization\Normalizer\EntityReferenceFieldItemNormalizer @group serialization
EntityReferenceFieldItemNormalizerTrait trait Drupal\serialization\Normalizer core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizerTrait.php Converts empty reference values for entity reference items. 1
EntityReferenceFieldNormalizer class Drupal\jsonapi\Normalizer core/modules/jsonapi/src/Normalizer/EntityReferenceFieldNormalizer.php Normalizer class specific for entity reference field objects.
EntityReferenceFieldTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceFieldTest.php Tests for the entity reference field.
EntityReferenceFieldTranslatedReferenceViewTest class Drupal\Tests\field\Functional\EntityReference core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFieldTranslatedReferenceViewTest.php Tests the translation of entity reference field display on nodes.
EntityReferenceFileUploadTest class Drupal\Tests\field\Functional\EntityReference core/modules/field/tests/src/Functional/EntityReference/EntityReferenceFileUploadTest.php Tests an autocomplete widget with file upload.
EntityReferenceFormatterBase abstract class Drupal\Core\Field\Plugin\Field\FieldFormatter core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceFormatterBase.php Parent plugin for entity reference formatters. 7 4
EntityReferenceFormatterTest class Drupal\Tests\field\Kernel\EntityReference core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceFormatterTest.php Tests the formatters functionality.
EntityReferenceHandlerSettingUpdateTest class Drupal\Tests\field\Functional\Update core/modules/field/tests/src/Functional/Update/EntityReferenceHandlerSettingUpdateTest.php Tests the update for the entity reference 'handler' setting.
EntityReferenceIdFormatter class Drupal\Core\Field\Plugin\Field\FieldFormatter core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceIdFormatter.php Plugin implementation of the 'entity reference ID' formatter.
EntityReferenceIntegrationTest class Drupal\Tests\field\Functional\EntityReference core/modules/field/tests/src/Functional/EntityReference/EntityReferenceIntegrationTest.php Tests various Entity reference UI components.
EntityReferenceItem class Drupal\Core\Field\Plugin\Field\FieldType core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php Defines the 'entity_reference' entity field type. 2 19
EntityReferenceItemNormalizer class Drupal\hal\Normalizer core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php Converts the Drupal entity reference item object to HAL array structure. 2
EntityReferenceItemTest class Drupal\Tests\field\Kernel\EntityReference core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php Tests the new entity API for the entity reference field type.
EntityReferenceLabelFormatter class Drupal\Core\Field\Plugin\Field\FieldFormatter core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php Plugin implementation of the 'entity reference label' formatter.
EntityReferenceRdfaTest class Drupal\Tests\rdf\Kernel\Field core/modules/rdf/tests/src/Kernel/Field/EntityReferenceRdfaTest.php Tests the RDFa output of the entity reference field formatter.
EntityReferenceRelationshipTest class Drupal\Tests\field\Kernel\EntityReference\Views core/modules/field/tests/src/Kernel/EntityReference/Views/EntityReferenceRelationshipTest.php Tests entity reference relationship data.
EntityReferenceSelection class Drupal\Core\Entity\Annotation core/lib/Drupal/Core/Entity/Annotation/EntityReferenceSelection.php Defines an EntityReferenceSelection plugin annotation object.
EntityReferenceSelectionAccessTest class Drupal\Tests\system\Functional\Entity\EntityReferenceSelection core/modules/system/tests/src/Functional/Entity/EntityReferenceSelection/EntityReferenceSelectionAccessTest.php Tests for the base handlers provided by Entity Reference.
EntityReferenceSelectionReferenceableTest class Drupal\Tests\system\Kernel\Entity core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php Tests entity reference selection plugins.
EntityReferenceSelectionSortTest class Drupal\KernelTests\Core\Entity\EntityReferenceSelection core/tests/Drupal/KernelTests/Core/Entity/EntityReferenceSelection/EntityReferenceSelectionSortTest.php Tests sorting referenced items.
EntityReferenceSelectionUnitTest class Drupal\Tests\Core\EntityReferenceSelection core/tests/Drupal/Tests/Core/EntityReferenceSelection/EntityReferenceSelectionUnitTest.php Provides unit testing for selection handlers.
EntityReferenceSettingsTest class Drupal\Tests\field\Kernel\EntityReference core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php Tests entity reference field settings.
EntityReferenceSupportedNewEntitiesConstraint class Drupal\workspaces\Plugin\Validation\Constraint core/modules/workspaces/src/Plugin/Validation/Constraint/EntityReferenceSupportedNewEntitiesConstraint.php The entity reference supported new entities constraint.
EntityReferenceSupportedNewEntitiesConstraintValidator class Drupal\workspaces\Plugin\Validation\Constraint core/modules/workspaces/src/Plugin/Validation/Constraint/EntityReferenceSupportedNewEntitiesConstraintValidator.php Checks if new entities created for entity reference fields are supported.
EntityReferenceSupportedNewEntitiesConstraintValidatorTest class Drupal\Tests\workspaces\Kernel core/modules/workspaces/tests/src/Kernel/EntityReferenceSupportedNewEntitiesConstraintValidatorTest.php @coversDefaultClass \Drupal\workspaces\Plugin\Validation\Constraint\EntityReferenceSupportedNewEntitiesConstraintValidator @group workspaces
EntityReferenceTaxonomyTermRssFormatter class Drupal\taxonomy\Plugin\Field\FieldFormatter core/modules/taxonomy/src/Plugin/Field/FieldFormatter/EntityReferenceTaxonomyTermRssFormatter.php Plugin implementation of the 'entity reference taxonomy term RSS' formatter.
EntityReferenceTestTrait

in drupal:8.6.2 and is removed from drupal:9.0.0. Use Drupal\Tests\field\Traits\EntityReferenceTestTrait instead.

trait Drupal\field\Tests\EntityReference core/modules/field/src/Tests/EntityReference/EntityReferenceTestTrait.php Provides common functionality for the EntityReference test classes.
EntityReferenceTestTrait trait Drupal\Tests\field\Traits core/modules/field/tests/src/Traits/EntityReferenceTestTrait.php Provides common functionality for the EntityReference test classes. 45
EntityReferenceTranslationDeriver class Drupal\migrate_drupal\Plugin\migrate core/modules/migrate_drupal/src/Plugin/migrate/EntityReferenceTranslationDeriver.php Deriver for entity reference field translations. 2
EntityReferenceWidgetTest class Drupal\Tests\media_library\FunctionalJavascript core/modules/media_library/tests/src/FunctionalJavascript/EntityReferenceWidgetTest.php Tests the Media library entity reference widget.
EntityReferenceXSSTest class Drupal\Tests\field\Functional\EntityReference core/modules/field/tests/src/Functional/EntityReference/EntityReferenceXSSTest.php Tests possible XSS security issues in entity references.
EntityRepository class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityRepository.php Provides several mechanisms for retrieving entities. 1 2
EntityRepositoryInterface interface Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityRepositoryInterface.php Provides an interface for an entity repository. 2 59
EntityRepositoryTest class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php @coversDefaultClass \Drupal\Core\Entity\EntityRepository @group Entity
EntityRepositoryTest class Drupal\KernelTests\Core\Entity core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php Tests the entity repository.
EntityResolverInterface interface Drupal\serialization\EntityResolver core/modules/serialization/src/EntityResolver/EntityResolverInterface.php 3 1
EntityResolverManager class Drupal\Core\Entity core/lib/Drupal/Core/Entity/EntityResolverManager.php Sets the entity route parameter converter options automatically. 2 2
EntityResolverManagerTest class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php @coversDefaultClass \Drupal\Core\Entity\EntityResolverManager @group Entity
EntityResolverTest class Drupal\Tests\serialization\Kernel core/modules/serialization/tests/src/Kernel/EntityResolverTest.php Tests that entities references can be resolved.
EntityResource class Drupal\jsonapi\Controller core/modules/jsonapi/src/Controller/EntityResource.php Process all entity requests. 2
EntityResource class Drupal\rest\Plugin\rest\resource core/modules/rest/src/Plugin/rest/resource/EntityResource.php Represents entities as resources. 1 1

Other projects


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