You are here

function views_skinr_ui_element_options in Skinr 8.2

Same name and namespace in other branches
  1. 7.2 modules/views.skinr.inc \views_skinr_ui_element_options()

Implements hook_skinr_ui_element_options().

File

modules/views.skinr.inc, line 20
Implements Skinr hooks for views.module.

Code

function views_skinr_ui_element_options($theme_name = NULL) {
  $options = array(
    'view' => array(),
  );
  $views = \Drupal\views\Views::getEnabledViews();

  // Load all enabled blocks.
  foreach ($views as $view) {
    foreach ($view
      ->get('display') as $display_id => $display) {
      if (empty($display)) {
        continue;
      }
      $name = $view
        ->id() . '__' . $display_id;

      // Fake indentation for view sub-items for better visual result.
      $options['view'][$view
        ->label()][$name] = $display['display_title'];
    }
  }
  ksort($options['view']);
  return $options;
}