EntityViewDisplayInterface.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Drupal\Core\Entity\Display;
  3. use Drupal\Core\Entity\FieldableEntityInterface;
  4. /**
  5. * Provides a common interface for entity view displays.
  6. */
  7. interface EntityViewDisplayInterface extends EntityDisplayInterface {
  8. /**
  9. * Builds a renderable array for the components of an entity.
  10. *
  11. * See the buildMultiple() method for details.
  12. *
  13. * @param \Drupal\Core\Entity\FieldableEntityInterface $entity
  14. * The entity being displayed.
  15. *
  16. * @return array
  17. * A renderable array for the entity.
  18. *
  19. * @see \Drupal\Core\Entity\Display\EntityViewDisplayInterface::buildMultiple()
  20. */
  21. public function build(FieldableEntityInterface $entity);
  22. /**
  23. * Builds a renderable array for the components of a set of entities.
  24. *
  25. * This only includes the components handled by the Display object, but
  26. * excludes 'extra fields', that are typically rendered through specific,
  27. * ad-hoc code in EntityViewBuilderInterface::buildComponents() or in
  28. * hook_entity_view() implementations.
  29. *
  30. * hook_entity_display_build_alter() is invoked on each entity, allowing 3rd
  31. * party code to alter the render array.
  32. *
  33. * @param \Drupal\Core\Entity\FieldableEntityInterface[] $entities
  34. * The entities being displayed.
  35. *
  36. * @return array
  37. * A renderable array for the entities, indexed by the same keys as the
  38. * $entities array parameter.
  39. *
  40. * @see hook_entity_display_build_alter()
  41. */
  42. public function buildMultiple(array $entities);
  43. }