ViewListBuilder::getDisplaysList

protected ViewListBuilder::getDisplaysList(EntityInterface $view)

Gets a list of displays included in the view.

Parameters

\Drupal\Core\Entity\EntityInterface $view: The view entity instance to get a list of displays for.

Return value

array An array of display types that this view includes.

File

core/modules/views_ui/src/ViewListBuilder.php, line 243

Class

ViewListBuilder
Defines a class to build a listing of view entities.

Namespace

Drupal\views_ui

Code

protected function getDisplaysList(EntityInterface $view) {
  $displays = array();
  foreach ($view->get('display') as $display) {
    $definition = $this->displayManager->getDefinition($display['display_plugin']);
    if (!empty($definition['admin'])) {
      // Cast the admin label to a string since it is an object.
      // @see \Drupal\Core\StringTranslation\TranslatableMarkup
      $displays[] = (string) $definition['admin'];
    }
  }

  sort($displays);
  return $displays;
}
doc_Drupal
2016-10-29 09:54:38
Comments
Leave a Comment

Please login to continue.