function EntityViewDisplay::collectRenderDisplay

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php \Drupal\Core\Entity\Entity\EntityViewDisplay::collectRenderDisplay()
  2. 8.9.x core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php \Drupal\Core\Entity\Entity\EntityViewDisplay::collectRenderDisplay()
  3. 10 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()

6 calls to EntityViewDisplay::collectRenderDisplay()
DateTestBase::renderTestEntity in core/modules/datetime/tests/src/Functional/DateTestBase.php
Renders an 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.
LayoutBuilderIsActiveCacheContext::getDisplay in core/modules/layout_builder/src/Cache/LayoutBuilderIsActiveCacheContext.php
Returns the entity view display for a given entity type and view mode.
LayoutEntityHelperTrait::getSectionStorageForEntity in core/modules/layout_builder/src/LayoutEntityHelperTrait.php
Gets the section storage for an entity.
LayoutEntityHelperTraitTest::testGetSectionStorageForEntity in core/modules/layout_builder/tests/src/Kernel/LayoutEntityHelperTraitTest.php
@covers ::getSectionStorageForEntity

... See full list

File

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

Class

EntityViewDisplay
Configuration entity.

Namespace

Drupal\Core\Entity\Entity

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.