You are here

public function ArgumentPluginBase::submitOptionsForm in Views (for Drupal 7) 8.3

Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.

Overrides HandlerBase::submitOptionsForm

File

lib/Drupal/views/Plugin/views/argument/ArgumentPluginBase.php, line 394
Definition of Drupal\views\Plugin\views\argument\ArgumentPluginBase.

Class

ArgumentPluginBase
Base class for arguments.

Namespace

Drupal\views\Plugin\views\argument

Code

public function submitOptionsForm(&$form, &$form_state) {
  if (empty($form_state['values']['options'])) {
    return;
  }

  // Let the plugins make submit modifications if necessary.
  $default_id = $form_state['values']['options']['default_argument_type'];
  $plugin = $this
    ->get_plugin('argument_default', $default_id);
  if ($plugin) {
    $options =& $form_state['values']['options']['argument_default'][$default_id];
    $plugin
      ->submitOptionsForm($form['argument_default'][$default_id], $form_state, $options);

    // Copy the now submitted options to their final resting place so they get saved.
    $form_state['values']['options']['default_argument_options'] = $options;
  }

  // summary plugin
  $summary_id = $form_state['values']['options']['summary']['format'];
  $plugin = $this
    ->get_plugin('style', $summary_id);
  if ($plugin) {
    $options =& $form_state['values']['options']['summary']['options'][$summary_id];
    $plugin
      ->submitOptionsForm($form['summary']['options'][$summary_id], $form_state, $options);

    // Copy the now submitted options to their final resting place so they get saved.
    $form_state['values']['options']['summary_options'] = $options;
  }
  $validate_id = $form_state['values']['options']['validate']['type'];
  $plugin = $this
    ->get_plugin('argument_validator', $validate_id);
  if ($plugin) {
    $options =& $form_state['values']['options']['validate']['options'][$validate_id];
    $plugin
      ->submitOptionsForm($form['validate']['options'][$validate_id], $form_state, $options);

    // Copy the now submitted options to their final resting place so they get saved.
    $form_state['values']['options']['validate_options'] = $options;
  }

  // Clear out the content of title if it's not enabled.
  $options =& $form_state['values']['options'];
  if (empty($options['title_enable'])) {
    $options['title'] = '';
  }
}