You are here

interface ExtraFieldDisplayInterface in Extra Field 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/ExtraFieldDisplayInterface.php \Drupal\extra_field\Plugin\ExtraFieldDisplayInterface

Defines an interface for Extra Field Display plugins.

Hierarchy

Expanded class hierarchy of ExtraFieldDisplayInterface

All classes that implement ExtraFieldDisplayInterface

File

src/Plugin/ExtraFieldDisplayInterface.php, line 12

Namespace

Drupal\extra_field\Plugin
View source
interface ExtraFieldDisplayInterface extends PluginInspectionInterface {

  /**
   * Builds a renderable array for the field.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
   *   The field's host entity.
   *
   * @return array
   *   Renderable array.
   */
  public function view(ContentEntityInterface $entity);

  /**
   * Stores the field's parent entity.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
   *   The entity that hosts the field.
   */
  public function setEntity(ContentEntityInterface $entity);

  /**
   * Returns the field's parent entity.
   *
   * @return \Drupal\Core\Entity\ContentEntityInterface
   *   The entity that hosts the field.
   */
  public function getEntity();

  /**
   * Stores the entity view display.
   *
   * @param \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display
   *   The entity view display holding the display options configured for the
   *   entity components. As provided by hook_entity_view()
   */
  public function setEntityViewDisplay(EntityViewDisplayInterface $display);

  /**
   * Returns the entity view display object of the field's host entity.
   *
   * @return \Drupal\Core\Entity\Display\EntityViewDisplayInterface
   *   The entity view display object.
   */
  public function getEntityViewDisplay();

  /**
   * Stores the entity view mode.
   *
   * @param string $viewMode
   *   The view mode the entity is rendered in. As provided by
   *   hook_entity_view().
   */
  public function setViewMode($viewMode);

  /**
   * Returns the entity view mode object of the field's host entity.
   *
   * @return string
   *   The view mode the field is being rendered in.
   */
  public function getViewMode();

}

Members

Namesort descending Modifiers Type Description Overrides
ExtraFieldDisplayInterface::getEntity public function Returns the field's parent entity. 1
ExtraFieldDisplayInterface::getEntityViewDisplay public function Returns the entity view display object of the field's host entity. 1
ExtraFieldDisplayInterface::getViewMode public function Returns the entity view mode object of the field's host entity. 1
ExtraFieldDisplayInterface::setEntity public function Stores the field's parent entity. 1
ExtraFieldDisplayInterface::setEntityViewDisplay public function Stores the entity view display. 1
ExtraFieldDisplayInterface::setViewMode public function Stores the entity view mode. 1
ExtraFieldDisplayInterface::view public function Builds a renderable array for the field. 6
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2