You are here

function views_ui_change_style_form in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 6.3 includes/admin.inc \views_ui_change_style_form()

Form to change_style items in the views UI.

1 string reference to 'views_ui_change_style_form'
views_ui_ajax_forms in includes/admin.inc

File

includes/admin.inc, line 2632
admin.inc Provides the Views' administrative interface.

Code

function views_ui_change_style_form(&$form_state) {
  $view =& $form_state['view'];
  $display_id = $form_state['display_id'];
  $type = $form_state['type'];
  $id = $form_state['id'];
  $form = array(
    'options' => array(
      '#tree' => TRUE,
    ),
  );
  if (!$view
    ->set_display($display_id)) {
    views_ajax_render(t('Invalid display id @display', array(
      '@display' => $display_id,
    )));
  }
  $item = $view
    ->get_item($display_id, $type, $id);
  if ($item) {
    $handler = views_get_handler($item['table'], $item['field'], $type);
    if (empty($handler)) {
      $form['markup'] = array(
        '#value' => t("Error: handler for @table > @field doesn't exist!", array(
          '@table' => $item['table'],
          '@field' => $item['field'],
        )),
      );
    }
    else {
      $handler
        ->init($view, $item);
      $types = views_object_types();
      $form['#title'] = t('Change summary style for @type %item', array(
        '@type' => $types[$type]['lstitle'],
        '%item' => $handler
          ->ui_name(),
      ));
      $form['#section'] = $display_id . '-' . $type . '-' . $id . '-style-plugin';
      $form['style_plugin'] = array(
        '#type' => 'radios',
        '#options' => views_fetch_plugin_names('style', 'summary'),
        '#default_value' => $item['style_plugin'],
      );
      $form_state['handler'] =& $handler;
    }
    views_ui_standard_form_buttons($form, $form_state, 'views_ui_change_style_form');
  }
  return $form;
}