public static function LegacyWrapper::getViewDisplay in Mini site 8
Returns the entity view display associated with a bundle and view mode.
Throws
\RuntimeException If compatible function is not found.
File
- src/
LegacyWrapper.php, line 64
Class
- LegacyWrapper
- Class LegacyWrapper.
Namespace
Drupal\minisiteCode
public static function getViewDisplay($entity_type, $bundle, $view_mode) {
$dr = \Drupal::service('entity_display.repository');
if (method_exists(get_class($dr), 'getViewDisplay')) {
return $dr
->getViewDisplay($entity_type, $bundle, $view_mode);
}
if (function_exists('entity_get_display')) {
return entity_get_display($entity_type, $bundle, $view_mode);
}
throw new \RuntimeException('Unable to find compatible function');
}