function template_preprocess_views_ui_edit_tab

File

includes/admin.inc, line 1118

Code

function template_preprocess_views_ui_edit_tab(&$vars) {
    $view = $vars['view'];
    $display = $vars['display'];
    $plugin = $display->handler->definition;
    $top = $left = $middle = $right = '';
    // If this form was submitted it was already handled, so force it not to
    // submit again.
    $vars['remove'] = '';
    $vars['clone'] = '';
    if (empty($plugin['no remove'])) {
        if (!empty($_POST['form_id']) && in_array($_POST['form_id'], array(
            'views_ui_remove_display_form',
            'views_ui_clone_display_form',
        ))) {
            unset($_POST['form_id']);
        }
        $form_state = array(
            'view' => &$view,
            'display_id' => $display->id,
            'ajax' => FALSE,
        );
        $vars['remove'] = drupal_build_form('views_ui_remove_display_form', $form_state);
        $vars['clone'] = drupal_build_form('views_ui_clone_display_form', $form_state);
    }
    // basic fields
    $vars['title'] = check_plain($display->display_title);
    $vars['description'] = check_plain($plugin['help']);
    // Special fields if this is the default display.
    $vars['default'] = $display->id == 'default';
    $vars['details_class'] = views_ui_item_css('details');
    foreach (array(
        'human_name',
        'tag',
        'description',
    ) as $property) {
        if (!empty($view->changed_sections[$property])) {
            $vars['details_changed'][$property] = TRUE;
        }
        switch ($property) {
            case 'human_name':
                $title = t('Human name');
                break;
            case 'tag':
                $title = t('Tag');
                break;
            case 'description':
                $title = t('Description');
                break;
        }
        $value = empty($view->{$property}) ? t('None') : $view->{$property};
        $vars['details'][$property] = $title . ': ' . l($value, "admin/build/views/nojs/{$property}/{$view->name}", array(
            'attributes' => array(
                'class' => 'views-ajax-link',
            ),
        ));
    }
    // Calculate options from display plugin.
    $options = $categories = array();
    $display->handler
        ->options_summary($categories, $options);
    // Build all of the options we were returned and put them into the
    // category data fields.
    foreach ($options as $id => $option) {
        if (empty($categories[$option['category']]['data'])) {
            $categories[$option['category']]['data'] = array();
        }
        $categories[$option['category']]['data'][$id] = array();
        $data =& $categories[$option['category']]['data'][$id];
        $data['content'] = '';
        $data['links'] = '';
        $data['overridden'] = FALSE;
        $data['defaulted'] = FALSE;
        // If there are optional links, build them first so they float properly.
        if (!empty($option['links'])) {
            foreach ($option['links'] as $link_id => $link_value) {
                $data['links'] .= $display->handler
                    ->option_link($link_value, $link_id, 'views-button-configure');
            }
        }
        if (!empty($option['title'])) {
            $data['content'] .= $option['title'] . ': ';
        }
        $data['content'] .= $display->handler
            ->option_link($option['value'], $id, '', empty($option['desc']) ? '' : $option['desc']);
        if (!empty($display->handler->options['defaults'][$id])) {
            $display_id = 'default';
            $data['defaulted'] = TRUE;
        }
        else {
            $display_id = $display->id;
            if (!$display->handler
                ->is_default_display()) {
                if ($display->handler
                    ->defaultable_sections($id)) {
                    $data['overridden'] = TRUE;
                }
            }
        }
        $data['class'] = views_ui_item_css($display_id . '-' . $id);
        if (!empty($view->changed_sections[$display_id . '-' . $id])) {
            $data['changed'] = TRUE;
        }
    }
    $vars['categories'] = $categories;
    // Add a help icon
    if (isset($plugin['help topic'])) {
        $vars['display_help_icon'] = theme('advanced_help_topic', $plugin['module'], $plugin['help topic']);
    }
    else {
        $vars['display_help_icon'] = '';
    }
    // Fetch style plugin info because it has some effect on how/what we render.
    $style_plugin = $display->handler
        ->get_plugin();
    $vars['fields'] = '';
    $vars['areas'] = array();
    foreach (array(
        'header',
        'footer',
        'empty',
    ) as $area) {
        $vars['areas'][$area] = theme('views_ui_edit_item', $area, $view, $display);
    }
    $vars['fields'] = theme('views_ui_edit_item', 'field', $view, $display, !($style_plugin && $style_plugin->uses_fields()));
    $vars['relationships'] = theme('views_ui_edit_item', 'relationship', $view, $display);
    $vars['arguments'] = theme('views_ui_edit_item', 'argument', $view, $display);
    $vars['filters'] = theme('views_ui_edit_item', 'filter', $view, $display);
    $vars['sorts'] = theme('views_ui_edit_item', 'sort', $view, $display);
}