class EntityType

Defines an Entity type annotation object.

Hierarchy

Expanded class hierarchy of EntityType

50 files declare their use of EntityType
Action.php in drupal/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php
Contains \Drupal\system\Plugin\Core\Entity\Action.
Block.php in drupal/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php
Contains \Drupal\block\Plugin\Core\Entity\Block.
Breakpoint.php in drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/Breakpoint.php
Definition of Drupal\breakpoint\Plugin\Core\Entity\Breakpoint.
BreakpointGroup.php in drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php
Definition of Drupal\breakpoint\Plugin\Core\Entity\BreakpointGroup.
BundleKeyTestEntity.php in drupal/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleKeyTestEntity.php
Contains Drupal\field_test\Plugin\Core\Entity\BundleKeyTestEntity.

... See full list

50 classes are annotated with EntityType
Action in drupal/core/modules/system/lib/Drupal/system/Plugin/Core/Entity/Action.php
Defines the configured action entity.
Block in drupal/core/modules/block/lib/Drupal/block/Plugin/Core/Entity/Block.php
Defines a Block configuration entity class.
Breakpoint in drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/Breakpoint.php
Defines the Breakpoint entity.
BreakpointGroup in drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Plugin/Core/Entity/BreakpointGroup.php
Defines the BreakpointGroup entity.
BundleKeyTestEntity in drupal/core/modules/field/tests/modules/field_test/lib/Drupal/field_test/Plugin/Core/Entity/BundleKeyTestEntity.php
Test entity class.

... See full list

File

drupal/core/lib/Drupal/Core/Entity/Annotation/EntityType.php, line 17
Contains \Drupal\Core\Entity\Annotation\EntityType.

Namespace

Drupal\Core\Entity\Annotation
View source
class EntityType extends Plugin {

  /**
   * The name of the module providing the type.
   *
   * @var string
   */
  public $module;

  /**
   * The name of the entity type class.
   *
   * This is not provided manually, it will be added by the discovery mechanism.
   *
   * @var string
   */
  public $class;

  /**
   * The name of the entity type's base table.
   *
   * @todo This is only used by \Drupal\Core\Entity\DatabaseStorageController.
   *
   * @var string
   */
  public $base_table;

  /**
   * An associative array where the keys are the names of different controller
   * types (listed below) and the values are the names of the classes that
   * implement that controller:
   * - storage: The name of the class that is used to load the objects. The
   *   class must implement \Drupal\Core\Entity\EntityStorageControllerInterface.
   * - form: An associative array where the keys are the names of the different
   *   form operations (such as 'create', 'edit', or 'delete') and the values
   *   are the names of the controller classes for those operations. The name of
   *   the operation is passed also to the form controller's constructor, so
   *   that one class can be used for multiple entity forms when the forms are
   *   similar. The classes must implement
   *   \Drupal\Core\Entity\EntityFormControllerInterface
   * - list: The name of the class that provides listings of the entities. The
   *   class must implement \Drupal\Core\Entity\EntityListControllerInterface.
   * - render: The name of the class that is used to render the entities. The
   *   class must implement \Drupal\Core\Entity\EntityRenderControllerInterface.
   * - access: The name of the class that is used for access checks. The class
   *   must implement \Drupal\Core\Entity\EntityAccessControllerInterface.
   *   Defaults to \Drupal\Core\Entity\EntityAccessController.
   * - translation: The name of the controller class that should be used to
   *   handle the translation process. The class must implement
   *   \Drupal\translation_entity\EntityTranslationControllerInterface.
   *
   * @todo Interfaces from outside \Drupal\Core or \Drupal\Component should not
   *   be used here.
   *
   * @var array
   */
  public $controllers = array(
    'access' => 'Drupal\\Core\\Entity\\EntityAccessController',
  );

  /**
   * Boolean indicating whether fields can be attached to entities of this type.
   *
   * @var bool (optional)
   */
  public $fieldable = FALSE;

  /**
   * Boolean indicating if the persistent cache of field data should be used.
   *
   * The persistent cache should usually only be disabled if a higher level
   * persistent cache is available for the entity type. Defaults to TRUE.
   *
   * @var bool (optional)
   */
  public $field_cache = TRUE;

  /**
   * The human-readable name of the type.
   *
   * @ingroup plugin_translatable
   *
   * @var \Drupal\Core\Annotation\Translation
   */
  public $label;

  /**
   * The human-readable name of the entity bundles, e.g. Vocabulary.
   *
   * @ingroup plugin_translatable
   *
   * @var \Drupal\Core\Annotation\Translation
   */
  public $bundle_label;

  /**
   * The name of a function that returns the label of the entity.
   *
   * The function takes an entity and optional langcode argument, and returns
   * the label of the entity. If langcode is omitted, the entity's default
   * language is used. The entity label is the main string associated with an
   * entity; for example, the title of a node or the subject of a comment. If
   * there is an entity object property that defines the label, use the 'label'
   * element of the 'entity_keys' return value component to provide this
   * information (see below). If more complex logic is needed to determine the
   * label of an entity, you can instead specify a callback function here, which
   * will be called to determine the entity label. See also the
   * \Drupal\Core\Entity\EntityInterface::label() method, which implements this
   * logic.
   *
   * @var string (optional)
   */
  public $label_callback;

  /**
   * Boolean indicating whether entities should be statically cached during a page request.
   *
   * @todo This is only used by \Drupal\Core\Entity\DatabaseStorageController.
   *
   * @var bool (optional)
   */
  public $static_cache = TRUE;

  /**
   * Boolean indicating whether entities of this type have multilingual support.
   *
   * At an entity level, this indicates language support and at a bundle level
   * this indicates translation support.
   *
   * @var bool (optional)
   */
  public $translatable = FALSE;

  /**
   * @todo translation_entity_entity_info_alter() uses this but it is undocumented.
   *
   * @var array
   */
  public $translation = array();

  /**
   * An array describing how the Field API can extract certain information from
   * objects of this entity type:
   * - id: The name of the property that contains the primary ID of the entity.
   *   Every entity object passed to the Field API must have this property and
   *   its value must be numeric.
   * - revision: (optional) The name of the property that contains the revision
   *   ID of the entity. The Field API assumes that all revision IDs are unique
   *   across all entities of a type. This entry can be omitted if the entities
   *   of this type are not versionable.
   * - bundle: (optional) The name of the property that contains the bundle name
   *   for the entity. The bundle name defines which set of fields are attached
   *   to the entity (e.g. what nodes call "content type"). This entry can be
   *   omitted if this entity type exposes a single bundle (such that all
   *   entities have the same collection of fields). The name of this single
   *   bundle will be the same as the entity type.
   * - label: The name of the property that contains the entity label. For
   *   example, if the entity's label is located in $entity->subject, then
   *   'subject' should be specified here. If complex logic is required to build
   *   the label, a 'label_callback' should be defined instead (see the
   *   $label_callback block above for details).
   * - uuid (optional): The name of the property that contains the universally
   *   unique identifier of the entity, which is used to distinctly identify an
   *   entity across different systems.
   *
   * @var array
   */
  public $entity_keys = array(
    'revision' => '',
    'bundle' => '',
  );

  /**
   * An array describing how the Field API can extract the information it needs
   * from the bundle objects for this type (e.g Vocabulary objects for terms;
   * not applicable for nodes):
   * - bundle: The name of the property that contains the name of the bundle
   *   object.
   *
   * This entry can be omitted if this type's bundles do not exist as standalone
   * objects.
   *
   * @var array
   */
  public $bundle_keys;

  /**
   * The base router path for the entity type's field administration page.
   *
   * If the entity type has a bundle, include {bundle} in the path.
   *
   * For example, the node entity type specifies
   * "admin/structure/types/manage/{bundle}" as its base field admin path.
   *
   * @var string (optional)
   */
  public $route_base_path;

  /**
   * The prefix for the bundles of this entity type.
   *
   * For example, the comment bundle is prefixed with 'comment_node_'.
   *
   * @var string (optional)
   */
  public $bundle_prefix;

  /**
   * The base menu router path to which the entity admin user interface responds.
   *
   * It can be used to generate UI links and to attach additional router items
   * to the entity UI in a generic fashion.
   *
   * @var string (optional)
   */
  public $menu_base_path;

  /**
   * The menu router path to be used to view the entity.
   *
   * @var string (optional)
   */
  public $menu_view_path;

  /**
   * The menu router path to be used to edit the entity.
   *
   * @var string (optional)
   */
  public $menu_edit_path;

  /**
   * A string identifying the menu loader in the router path.
   *
   * @var string (optional)
   */
  public $menu_path_wildcard;

  /**
   * Link templates using the URI template syntax.
   *
   * Links are an array of standard link relations to the URI template that
   * should be used for them. Where possible, link relationships should use
   * established IANA relationships rather than custom relationships.
   *
   * Every entity type should, at minimum, define "canonical", which is the
   * pattern for URIs to that entity. Even if the entity will have no HTML page
   * exposed to users it should still have a canonical URI in order to be
   * compatible with web services. Entities that will be user-editable via an
   * HTML page must also define an "edit-form" relationship.
   *
   * By default, the following placeholders are supported:
   * - entityType: The machine name of the entity type.
   * - bundle: The bundle machine name of the entity.
   * - id: The unique ID of the entity.
   * - uuid: The UUID of the entity.
   * - [entityType]: The entity type itself will also be a valid token for the
   *   ID of the entity. For instance, a placeholder of {node} used on the Node
   *   class would have the same value as {id}. This is generally preferred
   *   over "id" for better self-documentation.
   *
   * Specific entity types may also expand upon this list by overriding the
   * uriPlaceholderReplacements() method.
   *
   * @link http://www.iana.org/assignments/link-relations/link-relations.xml @endlink
   * @link http://tools.ietf.org/html/rfc6570 @endlink
   *
   * @var array
   */
  public $links = array(
    'canonical' => '/entity/{entityType}/{id}',
  );

  /**
   * Specifies whether a module exposing permissions for the current entity type
   * should use entity-type level granularity, bundle level granularity or just
   * skip this entity. The allowed values are respectively "entity_type",
   * "bundle" or FALSE.
   *
   * @var string|bool (optional)
   */
  public $permission_granularity = 'entity_type';

}

Members

Namesort descending Modifiers Type Description Overrides
EntityType::$base_table public property The name of the entity type's base table.
EntityType::$bundle_keys public property An array describing how the Field API can extract the information it needs from the bundle objects for this type (e.g Vocabulary objects for terms; not applicable for nodes):
EntityType::$bundle_label public property The human-readable name of the entity bundles, e.g. Vocabulary.
EntityType::$bundle_prefix public property The prefix for the bundles of this entity type.
EntityType::$class public property The name of the entity type class.
EntityType::$controllers public property An associative array where the keys are the names of different controller types (listed below) and the values are the names of the classes that implement that controller:
EntityType::$entity_keys public property An array describing how the Field API can extract certain information from objects of this entity type:
EntityType::$fieldable public property Boolean indicating whether fields can be attached to entities of this type.
EntityType::$field_cache public property Boolean indicating if the persistent cache of field data should be used.
EntityType::$label public property The human-readable name of the type.
EntityType::$label_callback public property The name of a function that returns the label of the entity.
EntityType::$links public property Link templates using the URI template syntax.
EntityType::$menu_base_path public property The base menu router path to which the entity admin user interface responds.
EntityType::$menu_edit_path public property The menu router path to be used to edit the entity.
EntityType::$menu_path_wildcard public property A string identifying the menu loader in the router path.
EntityType::$menu_view_path public property The menu router path to be used to view the entity.
EntityType::$module public property The name of the module providing the type.
EntityType::$permission_granularity public property Specifies whether a module exposing permissions for the current entity type should use entity-type level granularity, bundle level granularity or just skip this entity. The allowed values are respectively "entity_type", "bundle" or…
EntityType::$route_base_path public property The base router path for the entity type's field administration page.
EntityType::$static_cache public property Boolean indicating whether entities should be statically cached during a page request.
EntityType::$translatable public property Boolean indicating whether entities of this type have multilingual support.
EntityType::$translation public property @todo translation_entity_entity_info_alter() uses this but it is undocumented.
Plugin::$definition protected property The plugin definiton read from the class annotation.
Plugin::get public function Implements Drupal\Core\Annotation\AnnotationInterface::get(). Overrides AnnotationInterface::get
Plugin::parse protected function Parses an annotation into its definition.
Plugin::__construct public function Constructs a Plugin object.