function template_preprocess_views_ui_edit_tab in Views (for Drupal 7) 6.2
Same name and namespace in other branches
- 6.3 includes/admin.inc \template_preprocess_views_ui_edit_tab()
File
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 tihs is the default display.
$vars['default'] = $display->id == 'default';
$vars['details_class'] = views_ui_item_css('details');
if (!empty($view->changed_sections['details'])) {
$vars['details_changed'] = TRUE;
}
$tag = empty($view->tag) ? t('None') : $view->tag;
$vars['details'] = t('Description') . '/' . t('Tag') . ': ' . l($tag, "admin/build/views/nojs/details/{$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['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);
}