function template_preprocess_views_ui_view_preview_section

Theme preprocess for theme_views_ui_view_preview_section().

File

drupal/core/modules/views/views_ui/theme/theme.inc, line 452
Preprocessors and theme functions for the Views UI.

Code

function template_preprocess_views_ui_view_preview_section(&$vars) {
  switch ($vars['section']) {
    case 'title':
      $vars['title'] = t('Title');
      $links = views_ui_view_preview_section_display_category_links($vars['view'], 'title', $vars['title']);
      break;
    case 'header':
      $vars['title'] = t('Header');
      $links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
      break;
    case 'empty':
      $vars['title'] = t('No results behavior');
      $links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
      break;
    case 'exposed':

      // @todo Sorts can be exposed too, so we may need a better title.
      $vars['title'] = t('Exposed Filters');
      $links = views_ui_view_preview_section_display_category_links($vars['view'], 'exposed_form_options', $vars['title']);
      break;
    case 'rows':

      // @todo The title needs to depend on what is being viewed.
      $vars['title'] = t('Content');
      $links = views_ui_view_preview_section_rows_links($vars['view']);
      break;
    case 'pager':
      $vars['title'] = t('Pager');
      $links = views_ui_view_preview_section_display_category_links($vars['view'], 'pager_options', $vars['title']);
      break;
    case 'more':
      $vars['title'] = t('More');
      $links = views_ui_view_preview_section_display_category_links($vars['view'], 'use_more', $vars['title']);
      break;
    case 'footer':
      $vars['title'] = t('Footer');
      $links = views_ui_view_preview_section_handler_links($vars['view'], $vars['section']);
      break;
    case 'attachment_before':

      // @todo: Add links to the attachment configuration page.
      $vars['title'] = t('Attachment before');
      break;
    case 'attachment_after':

      // @todo: Add links to the attachment configuration page.
      $vars['title'] = t('Attachment after');
      break;
  }
  if (isset($links)) {
    $build = array(
      '#prefix' => '<div class="contextual">',
      '#suffix' => '</div>',
      '#theme' => 'links__contextual',
      '#links' => $links,
      '#attributes' => array(
        'class' => array(
          'contextual-links',
        ),
      ),
      '#attached' => array(
        'library' => array(
          array(
            'contextual',
            'contextual-links',
          ),
        ),
      ),
    );
    $vars['links'] = drupal_render($build);
  }
  $vars['theme_hook_suggestions'][] = 'views_ui_view_preview_section__' . $vars['section'];
}