function views_ui_config_item_form_submit_temporary

A submit handler that is used for storing temporary items when using multi-step changes, such as ajax requests.

1 string reference to 'views_ui_config_item_form_submit_temporary'
Field::buildOptionsForm in drupal/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
Default options form that provides the label widget that all fields should have.

File

drupal/core/modules/views/views_ui/admin.inc, line 1529
Provides the Views' administrative interface.

Code

function views_ui_config_item_form_submit_temporary($form, &$form_state) {

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

  // For footer/header $handler_type is area but $type is footer/header.
  // For all other handle types it's the same.
  $handler_type = $type = $form_state['type'];
  if (!empty($types[$type]['type'])) {
    $handler_type = $types[$type]['type'];
  }
  $override = NULL;
  $executable = $form_state['view']
    ->get('executable');
  if ($executable->display_handler
    ->useGroupBy() && !empty($item['group_type'])) {
    if (empty($executable->query)) {
      $executable
        ->initQuery();
    }
    $aggregate = $executable->query
      ->get_aggregation_info();
    if (!empty($aggregate[$item['group_type']]['handler'][$type])) {
      $override = $aggregate[$item['group_type']]['handler'][$type];
    }
  }

  // Create a new handler and unpack the options from the form onto it. We
  // can use that for storage.
  $handler = views_get_handler($item['table'], $item['field'], $handler_type, $override);
  $handler
    ->init($executable, $item);

  // Add the incoming options to existing options because items using
  // the extra form may not have everything in the form here.
  $options = $form_state['values']['options'] + $form_state['handler']->options;

  // This unpacks only options that are in the definition, ensuring random
  // extra stuff on the form is not sent through.
  $handler
    ->unpackOptions($handler->options, $options, NULL, FALSE);

  // Store the item back on the view
  $form_state['view']->temporary_options[$type][$form_state['id']] = $handler->options;

  // @todo: Figure out whether views_ui_ajax_form is perhaps the better place to fix the issue.
  // views_ui_ajax_form() drops the current form from the stack, even if it's an #ajax.
  // So add the item back to the top of the stack.
  $form_state['view']
    ->addFormToStack($form_state['form_key'], $form_state['display_id'], array(
    $type,
    $item['id'],
  ), TRUE);
  $form_state['rerender'] = TRUE;
  $form_state['rebuild'] = TRUE;

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