Same name in other branches
  1. 4.x src/Form/QuickTabsInstanceDuplicateForm.php \Drupal\quicktabs\Form\QuickTabsInstanceDuplicateForm::submitForm()

Form submission handler for the 'duplicate' 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.

File

src/Form/QuickTabsInstanceDuplicateForm.php, line 69

Class

QuickTabsInstanceDuplicateForm
Class QuickTabsInstanceDuplicateForm.

Namespace

Drupal\quicktabs\Form

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