public static function EntityViewDisplay::collectRenderDisplay

public static EntityViewDisplay::collectRenderDisplay(FieldableEntityInterface $entity, $view_mode)

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()

File

core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php, line 161

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()];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!Entity!EntityViewDisplay.php/function/EntityViewDisplay::collectRenderDisplay/8.1.x