You are here

public function EditDetails::submitForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/Form/Ajax/EditDetails.php \Drupal\views_ui\Form\Ajax\EditDetails::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides ViewsFormBase::submitForm

File

core/modules/views_ui/src/Form/Ajax/EditDetails.php, line 76
Contains \Drupal\views_ui\Form\Ajax\EditDetails.

Class

EditDetails
Provides a form for editing the details of a View.

Namespace

Drupal\views_ui\Form\Ajax

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $view = $form_state
    ->get('view');
  foreach ($form_state
    ->getValues() as $key => $value) {

    // Only save values onto the view if they're actual view properties
    // (as opposed to 'op' or 'form_build_id').
    if (isset($form['details'][$key])) {
      $view
        ->set($key, $value);
    }
  }
  $bases = Views::viewsData()
    ->fetchBaseTables();
  $page_title = $view
    ->label();
  if (isset($bases[$view
    ->get('base_table')])) {
    $page_title .= ' (' . $bases[$view
      ->get('base_table')]['title'] . ')';
  }
  $form_state
    ->set('page_title', $page_title);
  $view
    ->cacheSet();
}