You are here

interface EntityFieldManagerInterface in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityFieldManagerInterface.php \Drupal\Core\Entity\EntityFieldManagerInterface

Provides an interface for an entity field manager.

Hierarchy

Expanded class hierarchy of EntityFieldManagerInterface

All classes that implement EntityFieldManagerInterface

4 files declare their use of EntityFieldManagerInterface
EntityManagerTest.php in core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
Contains \Drupal\Tests\Core\Entity\EntityManagerTest.
FieldDefinitionListener.php in core/lib/Drupal/Core/Field/FieldDefinitionListener.php
Contains \Drupal\Core\Field\FieldDefinitionListener.
FieldDefinitionListenerTest.php in core/tests/Drupal/Tests/Core/Field/FieldDefinitionListenerTest.php
Contains \Drupal\Tests\Core\Field\FieldDefinitionListenerTest.
FieldStorageDefinitionListener.php in core/lib/Drupal/Core/Field/FieldStorageDefinitionListener.php
Contains \Drupal\Core\Field\FieldStorageDefinitionListener.

File

core/lib/Drupal/Core/Entity/EntityFieldManagerInterface.php, line 13
Contains \Drupal\Core\Entity\EntityFieldManagerInterface.

Namespace

Drupal\Core\Entity
View source
interface EntityFieldManagerInterface {

  /**
   * Gets the base field definitions for a content entity type.
   *
   * Only fields that are not specific to a given bundle or set of bundles are
   * returned. This excludes configurable fields, as they are always attached
   * to a specific bundle.
   *
   * @param string $entity_type_id
   *   The entity type ID. Only entity types that implement
   *   \Drupal\Core\Entity\FieldableEntityInterface are supported.
   *
   * @return \Drupal\Core\Field\FieldDefinitionInterface[]
   *   The array of base field definitions for the entity type, keyed by field
   *   name.
   *
   * @throws \LogicException
   *   Thrown if one of the entity keys is flagged as translatable.
   */
  public function getBaseFieldDefinitions($entity_type_id);

  /**
   * Gets the field definitions for a specific bundle.
   *
   * @param string $entity_type_id
   *   The entity type ID. Only entity types that implement
   *   \Drupal\Core\Entity\FieldableEntityInterface are supported.
   * @param string $bundle
   *   The bundle.
   *
   * @return \Drupal\Core\Field\FieldDefinitionInterface[]
   *   The array of field definitions for the bundle, keyed by field name.
   */
  public function getFieldDefinitions($entity_type_id, $bundle);

  /**
   * Gets the field storage definitions for a content entity type.
   *
   * This returns all field storage definitions for base fields and bundle
   * fields of an entity type. Note that field storage definitions of a base
   * field equal the full base field definition (i.e. they implement
   * FieldDefinitionInterface), while the storage definitions for bundle fields
   * may implement FieldStorageDefinitionInterface only.
   *
   * @param string $entity_type_id
   *   The entity type ID. Only content entities are supported.
   *
   * @return \Drupal\Core\Field\FieldStorageDefinitionInterface[]
   *   The array of field storage definitions for the entity type, keyed by
   *   field name.
   *
   * @see \Drupal\Core\Field\FieldStorageDefinitionInterface
   */
  public function getFieldStorageDefinitions($entity_type_id);

  /**
   * Gets a lightweight map of fields across bundles.
   *
   * @return array
   *   An array keyed by entity type. Each value is an array which keys are
   *   field names and value is an array with two entries:
   *   - type: The field type.
   *   - bundles: The bundles in which the field appears.
   */
  public function getFieldMap();

  /**
   * Sets a lightweight map of fields across bundles.
   *
   * @param array[] $field_map
   *   See the return value of self::getFieldMap().
   *
   * @return $this
   */
  public function setFieldMap(array $field_map);

  /**
   * Gets a lightweight map of fields across bundles filtered by field type.
   *
   * @param string $field_type
   *   The field type to filter by.
   *
   * @return array
   *   An array keyed by entity type. Each value is an array which keys are
   *   field names and value is an array with two entries:
   *   - type: The field type.
   *   - bundles: The bundles in which the field appears.
   */
  public function getFieldMapByFieldType($field_type);

  /**
   * Clears static and persistent field definition caches.
   */
  public function clearCachedFieldDefinitions();

  /**
   * Disable the use of caches.
   *
   * @param bool $use_caches
   *   FALSE to not use any caches.
   *
   * @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0.
   *
   * @todo Remove in https://www.drupal.org/node/2549143.
   */
  public function useCaches($use_caches = FALSE);

  /**
   * Gets the "extra fields" for a bundle.
   *
   * @param string $entity_type_id
   *   The entity type ID.
   * @param string $bundle
   *   The bundle name.
   *
   * @return array
   *   A nested array of 'pseudo-field' elements. Each list is nested within the
   *   following keys: entity type, bundle name, context (either 'form' or
   *   'display'). The keys are the name of the elements as appearing in the
   *   renderable array (either the entity form or the displayed entity). The
   *   value is an associative array:
   *   - label: The human readable name of the element. Make sure you sanitize
   *     this appropriately.
   *   - description: A short description of the element contents.
   *   - weight: The default weight of the element.
   *   - visible: (optional) The default visibility of the element. Defaults to
   *     TRUE.
   *   - edit: (optional) String containing markup (normally a link) used as the
   *     element's 'edit' operation in the administration interface. Only for
   *     'form' context.
   *   - delete: (optional) String containing markup (normally a link) used as the
   *     element's 'delete' operation in the administration interface. Only for
   *     'form' context.
   */
  public function getExtraFields($entity_type_id, $bundle);

}

Members

Namesort descending Modifiers Type Description Overrides
EntityFieldManagerInterface::clearCachedFieldDefinitions public function Clears static and persistent field definition caches. 2
EntityFieldManagerInterface::getBaseFieldDefinitions public function Gets the base field definitions for a content entity type. 2
EntityFieldManagerInterface::getExtraFields public function Gets the "extra fields" for a bundle. 2
EntityFieldManagerInterface::getFieldDefinitions public function Gets the field definitions for a specific bundle. 2
EntityFieldManagerInterface::getFieldMap public function Gets a lightweight map of fields across bundles. 2
EntityFieldManagerInterface::getFieldMapByFieldType public function Gets a lightweight map of fields across bundles filtered by field type. 2
EntityFieldManagerInterface::getFieldStorageDefinitions public function Gets the field storage definitions for a content entity type. 2
EntityFieldManagerInterface::setFieldMap public function Sets a lightweight map of fields across bundles. 2
EntityFieldManagerInterface::useCaches Deprecated public function Disable the use of caches. 1