class ContentEntityType

Same name in this branch
  1. main core/lib/Drupal/Core/Entity/ContentEntityType.php \Drupal\Core\Entity\ContentEntityType
  2. main core/lib/Drupal/Core/Entity/Annotation/ContentEntityType.php \Drupal\Core\Entity\Annotation\ContentEntityType
Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/ContentEntityType.php \Drupal\Core\Entity\ContentEntityType
  2. 11.x core/lib/Drupal/Core/Entity/Attribute/ContentEntityType.php \Drupal\Core\Entity\Attribute\ContentEntityType
  3. 11.x core/lib/Drupal/Core/Entity/Annotation/ContentEntityType.php \Drupal\Core\Entity\Annotation\ContentEntityType
  4. 10 core/lib/Drupal/Core/Entity/ContentEntityType.php \Drupal\Core\Entity\ContentEntityType
  5. 10 core/lib/Drupal/Core/Entity/Annotation/ContentEntityType.php \Drupal\Core\Entity\Annotation\ContentEntityType
  6. 9 core/lib/Drupal/Core/Entity/ContentEntityType.php \Drupal\Core\Entity\ContentEntityType
  7. 9 core/lib/Drupal/Core/Entity/Annotation/ContentEntityType.php \Drupal\Core\Entity\Annotation\ContentEntityType
  8. 8.9.x core/lib/Drupal/Core/Entity/ContentEntityType.php \Drupal\Core\Entity\ContentEntityType
  9. 8.9.x core/lib/Drupal/Core/Entity/Annotation/ContentEntityType.php \Drupal\Core\Entity\Annotation\ContentEntityType

Defines a content entity type for plugin discovery.

Content entity type plugins use an object-based attribute method, rather than an array-type (as commonly used on other plugin types). The attribute properties of content entity types are found on \Drupal\Core\Entity\ContentEntityType and are accessed using get/set methods defined in \Drupal\Core\Entity\ContentEntityTypeInterface.

Attributes

#[\Attribute(\Attribute::TARGET_CLASS)]

Hierarchy

Expanded class hierarchy of ContentEntityType

See also

\Drupal\Core\Entity\EntityType

\Drupal\Core\Entity\ContentEntityType

\Drupal\Core\Entity\ContentEntityTypeInterface

Related topics

64 files declare their use of ContentEntityType
BlockContent.php in core/modules/block_content/src/Entity/BlockContent.php
Comment.php in core/modules/comment/src/Entity/Comment.php
CommentTestBaseField.php in core/modules/comment/tests/modules/comment_base_field_test/src/Entity/CommentTestBaseField.php
ContentModerationState.php in core/modules/content_moderation/src/Entity/ContentModerationState.php
EntitySerializedField.php in core/modules/system/tests/modules/entity_test/src/Entity/EntitySerializedField.php

... See full list

File

core/lib/Drupal/Core/Entity/Attribute/ContentEntityType.php, line 22

Namespace

Drupal\Core\Entity\Attribute
View source
class ContentEntityType extends EntityType {
  public function __construct(public readonly string $id, public readonly ?TranslatableMarkup $label = NULL, public readonly ?TranslatableMarkup $label_collection = NULL, public readonly ?TranslatableMarkup $label_singular = NULL, public readonly ?TranslatableMarkup $label_plural = NULL, public readonly string $entity_type_class = 'Drupal\\Core\\Entity\\ContentEntityType', public readonly string $group = 'content', public readonly TranslatableMarkup $group_label = new TranslatableMarkup('Content', [], [
    'context' => 'Entity type group',
  ]), public readonly bool $static_cache = TRUE, public readonly bool $render_cache = TRUE, public readonly bool $persistent_cache = TRUE, protected readonly array $entity_keys = [], protected readonly array $handlers = [], protected readonly array $links = [], public readonly ?string $admin_permission = NULL, public readonly ?string $collection_permission = NULL, public readonly string $permission_granularity = 'entity_type', public readonly ?string $bundle_entity_type = NULL, public readonly ?string $bundle_of = NULL, public readonly ?TranslatableMarkup $bundle_label = NULL, public readonly ?string $base_table = NULL, public readonly ?string $data_table = NULL, public readonly ?string $revision_table = NULL, public readonly ?string $revision_data_table = NULL, public readonly bool $internal = FALSE, public readonly bool $translatable = FALSE, public readonly bool $show_revision_ui = FALSE, public readonly array $label_count = [], public readonly ?string $uri_callback = NULL, public readonly ?string $field_ui_base_route = NULL, public readonly bool $common_reference_target = FALSE, public readonly array $list_cache_contexts = [], public readonly array $list_cache_tags = [], public readonly array $constraints = [], public readonly array $revision_metadata_keys = [], public readonly array $additional = []) {
    // @phpstan-ignore property.deprecated
    if ($this->uri_callback !== NULL) {
      @trigger_error('The "uri_callback" property on entity types is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use link templates or a route provider to specify entity URIs. See https://www.drupal.org/node/3575062', E_USER_DEPRECATED);
    }
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AttributeBase::$class protected property The class used for this attribute class.
AttributeBase::$dependencies protected property The dependencies for the attribute class.
AttributeBase::$provider protected property The provider of the attribute class.
AttributeBase::getClass public function Overrides AttributeInterface::getClass 1
AttributeBase::getDependencies public function Overrides AttributeInterface::getDependencies
AttributeBase::getId public function Overrides AttributeInterface::getId
AttributeBase::getProvider public function Overrides AttributeInterface::getProvider
AttributeBase::setClass public function Overrides AttributeInterface::setClass 1
AttributeBase::setDependencies public function Overrides AttributeInterface::setDependencies
AttributeBase::setProvider public function Overrides AttributeInterface::setProvider
ContentEntityType::__construct public function Overrides EntityType::__construct
EntityType::get public function Overrides AttributeBase::get

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