You are here

public function ViewContent::getViewDisplays in Quick Tabs 8.3

Get displays for a given view.

1 call to ViewContent::getViewDisplays()
ViewContent::optionsForm in src/Plugin/TabType/ViewContent.php
Return form elements used on the edit/add from.

File

src/Plugin/TabType/ViewContent.php, line 171

Class

ViewContent
Provides a 'view content' tab type.

Namespace

Drupal\quicktabs\Plugin\TabType

Code

public function getViewDisplays($view_name) {
  $displays = [];
  if (empty($view_name)) {
    return $displays;
  }
  $view = \Drupal::entityTypeManager()
    ->getStorage('view')
    ->load($view_name);
  if (!$view) {
    return $displays;
  }
  foreach ($view
    ->get('display') as $id => $display) {
    $enabled = !empty($display['display_options']['enabled']) || !array_key_exists('enabled', $display['display_options']);
    if ($enabled) {
      $displays[$id] = $id . ': ' . $display['display_title'];
    }
  }
  return $displays;
}