You are here

interface ExtraFieldDisplayFormattedInterface in Extra Field 8

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

Defines an interface for Extra Field Display plugins.

Hierarchy

Expanded class hierarchy of ExtraFieldDisplayFormattedInterface

All classes that implement ExtraFieldDisplayFormattedInterface

File

src/Plugin/ExtraFieldDisplayFormattedInterface.php, line 10

Namespace

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

  /**
   * Returns the renderable array of the field item(s).
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
   *   The field's host entity.
   *
   * @return array
   *   A renderable array of field elements. If this contains children, the
   *   field output will be rendered as a multiple value field with each child
   *   as a field item.
   */
  public function viewElements(ContentEntityInterface $entity);

  /**
   * The label of the field.
   *
   * If applicable, the code has to take care of the translatability.
   *
   * @return string|\Drupal\Core\StringTranslation\TranslatableMarkup
   *   The field label.
   */
  public function getLabel();

  /**
   * How to display the field label will be displayed.
   *
   * @return string
   *   Options: 'above', 'inline', 'hidden', 'visually_hidden'.
   */
  public function getLabelDisplay();

  /**
   * The type of field.
   *
   * Used in the 'field--type-...' wrapper class.
   *
   * @return string
   *   The field type.
   */
  public function getFieldType();

  /**
   * The machine name of the field.
   *
   * Used in the 'field--name-...' wrapper class.
   *
   * @return string
   *   The field name.
   */
  public function getFieldName();

  /**
   * Check if the extra field has data.
   *
   * @return bool
   *   True if the field has no actual data to render. False if it only contains
   *   non-visible render elements such as #cache and #attached.
   */
  public function isEmpty();

  /**
   * Gets the langcode of the field values.
   *
   * @return string
   *   The langcode.
   */
  public function getLangcode();

  /**
   * The field is translatable.
   *
   * @return bool
   *   Whether the field's content is translatable.
   */
  public function isTranslatable();

}

Members

Namesort descending Modifiers Type Description Overrides
ExtraFieldDisplayFormattedInterface::getFieldName public function The machine name of the field. 1
ExtraFieldDisplayFormattedInterface::getFieldType public function The type of field. 1
ExtraFieldDisplayFormattedInterface::getLabel public function The label of the field. 1
ExtraFieldDisplayFormattedInterface::getLabelDisplay public function How to display the field label will be displayed. 1
ExtraFieldDisplayFormattedInterface::getLangcode public function Gets the langcode of the field values. 1
ExtraFieldDisplayFormattedInterface::isEmpty public function Check if the extra field has data. 1
ExtraFieldDisplayFormattedInterface::isTranslatable public function The field is translatable. 1
ExtraFieldDisplayFormattedInterface::viewElements public function Returns the renderable array of the field item(s). 6
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