ViewDuplicateForm::submitForm

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

Form submission handler for the 'clone' action.

Parameters

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

\Drupal\Core\Form\FormStateInterface $form_state: A reference to a keyed array containing the current state of the form.

Overrides EntityForm::submitForm

File

core/modules/views_ui/src/ViewDuplicateForm.php, line 68

Class

ViewDuplicateForm
Form controller for the Views duplicate form.

Namespace

Drupal\views_ui

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->entity = $this->entity->createDuplicate();
  $this->entity->set('label', $form_state->getValue('label'));
  $this->entity->set('id', $form_state->getValue('id'));
  $this->entity->save();

  // Redirect the user to the view admin form.
  $form_state->setRedirectUrl($this->entity->urlInfo('edit-form'));
}
doc_Drupal
2016-10-29 09:53:54
Comments
Leave a Comment

Please login to continue.