function EditDetails::submitForm

Same name in other branches
  1. 9 core/modules/views_ui/src/Form/Ajax/EditDetails.php \Drupal\views_ui\Form\Ajax\EditDetails::submitForm()
  2. 10 core/modules/views_ui/src/Form/Ajax/EditDetails.php \Drupal\views_ui\Form\Ajax\EditDetails::submitForm()
  3. 11.x core/modules/views_ui/src/Form/Ajax/EditDetails.php \Drupal\views_ui\Form\Ajax\EditDetails::submitForm()

Overrides ViewsFormBase::submitForm

File

core/modules/views_ui/src/Form/Ajax/EditDetails.php, line 73

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.