You are here

function views_ui_config_item_form_submit in Views (for Drupal 7) 6.2

Same name and namespace in other branches
  1. 8.3 views_ui/admin.inc \views_ui_config_item_form_submit()
  2. 6.3 includes/admin.inc \views_ui_config_item_form_submit()
  3. 7.3 includes/admin.inc \views_ui_config_item_form_submit()

Submit handler for configing new item(s) to a view.

File

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

Code

function views_ui_config_item_form_submit($form, &$form_state) {

  // Run it through the handler's submit function.
  $form_state['handler']
    ->options_submit($form['options'], $form_state);
  $item = $form_state['handler']->options;

  // Unset a button
  unset($form_state['values']['options']['expose_button']);

  // Store the data we're given.
  foreach ($form_state['values']['options'] as $key => $value) {
    $item[$key] = $value;
  }

  // Store the item back on the view
  $form_state['view']
    ->set_item($form_state['display_id'], $form_state['type'], $form_state['id'], $item);
  $handler = views_get_handler($item['table'], $item['field'], $form_state['type']);
  $handler
    ->init($form_state['view'], $item);
  if ($handler && $handler
    ->needs_style_plugin()) {
    views_ui_add_form_to_stack('change-style', $form_state['view'], $form_state['display_id'], array(
      $form_state['type'],
      $form_state['id'],
    ), TRUE);
  }

  // Write to cache
  views_ui_cache_set($form_state['view']);
}