EditDetails::submitForm

public EditDetails::submitForm(array &$form, FormStateInterface $form_state)

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 71

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();
}
doc_Drupal
2016-10-29 09:03:32
Comments
Leave a Comment

Please login to continue.