protected function EntityViewBuilder::isViewModeCacheable

protected EntityViewBuilder::isViewModeCacheable($view_mode)

Determines whether the view mode is cacheable.

Parameters

string $view_mode: Name of the view mode that should be rendered.

Return value

bool TRUE if the view mode can be cached, FALSE otherwise.

File

core/lib/Drupal/Core/Entity/EntityViewBuilder.php, line 368

Class

EntityViewBuilder
Base class for entity view builders.

Namespace

Drupal\Core\Entity

Code

protected function isViewModeCacheable($view_mode) {
  if ($view_mode == 'default') {
    // The 'default' is not an actual view mode.
    return TRUE;
  }
  $view_modes_info = $this->entityManager->getViewModes($this->entityTypeId);
  return !empty($view_modes_info[$view_mode]['cache']);
}

© 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!EntityViewBuilder.php/function/EntityViewBuilder::isViewModeCacheable/8.1.x