1 views_ui.module _views_ui_get_displays($view)

Helper function to get a list of displays assigned to a view, and their respective paths if any.

Parameters

$view: The view.

Return value

An array of displays and their respective paths.:

File

core/modules/views_ui/views_ui.module, line 964
Provide structure for the administrative interface to Views.

Code

function _views_ui_get_displays($view) {
  $show_default_display = config_get('views_ui.settings', 'show_default_display');
  $all_displays = array();

  if (empty($view->display)) {
    $all_displays[] = t('Configure this view to add a display.');
  }
  else {
    // Make sure all the handlers are set up.
    $view->init_display();
    // Start compiling a list of displays for each view.
    foreach ($view->display as $display) {
      if (!empty($display->handler)) {
        // Add the Default display to the list only if the "Always show
        // the Default display" setting is enabled in the Views UI settings.
        if ($display->display_plugin != 'default' || $show_default_display) {
          $display_item = $display->display_title;
          if (!empty($display->handler->options['block_description'])) {
            $display_item .= ': <em>' . $display->handler->options['block_description'] . '</em>';
          }
          if ($display->handler->has_path()) {
            $one_path = $display->handler->get_option('path');
            if (empty($path_sort)) {
              $path_sort = strtolower($one_path);
            }
            // If the view is not disabled, and the path does not contain
            // argument placeholders...
            if (empty($view->disabled) && strpos($one_path, '%') === FALSE) {
              // ...convert the display path to a link.
              $display_path = l('/' . $one_path, $one_path);
            }
            else {
              // Otherwise output the path as plain text.
              $display_path = check_plain('/' . $one_path);
            }
            $display_item .= ": " . $display_path;
          }
          $all_displays[] = $display_item;
        }
      }
    }
  }

  return array_unique($all_displays);
}