You are here

public static function EntityViewDisplay::collectRenderDisplay in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php \Drupal\Core\Entity\Entity\EntityViewDisplay::collectRenderDisplay()

Returns the display object used to render an entity.

See the collectRenderDisplays() method for details.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: The entity being rendered.

string $view_mode: The view mode.

Return value

\Drupal\Core\Entity\Display\EntityViewDisplayInterface The display object that should be used to render the entity.

See also

\Drupal\Core\Entity\Entity\EntityViewDisplay::collectRenderDisplays()

2 calls to EntityViewDisplay::collectRenderDisplay()
DateTimeFieldTest::renderTestEntity in core/modules/datetime/src/Tests/DateTimeFieldTest.php
Renders a entity_test and sets the output in the internal browser.
EntityViewBuilder::getSingleFieldDisplay in core/lib/Drupal/Core/Entity/EntityViewBuilder.php
Gets an EntityViewDisplay for rendering an individual field.

File

core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php, line 166
Contains \Drupal\Core\Entity\Entity\EntityViewDisplay.

Class

EntityViewDisplay
Configuration entity that contains display options for all components of a rendered entity in a given view mode.

Namespace

Drupal\Core\Entity\Entity

Code

public static function collectRenderDisplay(FieldableEntityInterface $entity, $view_mode) {
  $displays = static::collectRenderDisplays(array(
    $entity,
  ), $view_mode);
  return $displays[$entity
    ->bundle()];
}