Same name and namespace in other branches
  1. 4.x src/Form/QuickTabsInstanceEditForm.php \Drupal\quicktabs\Form\QuickTabsInstanceEditForm::save() 1 comment

File

src/Form/QuickTabsInstanceEditForm.php, line 289

Class

QuickTabsInstanceEditForm
Class QuickTabsInstanceEditForm.

Namespace

Drupal\quicktabs\Form

Code

public function save(array $form, FormStateInterface $form_state) {
    // We need the configuration_data array to be indexed according to weight
    // So change the indexes here.
    $ordered_configuration_data = [];
    foreach ($this->entity
        ->getConfigurationData() as $item) {
        $ordered_configuration_data[] = $item;
    }
    $this->entity
        ->setConfigurationData($ordered_configuration_data);
    $status = $this->entity
        ->save();
    if ($status == SAVED_NEW) {
        $form_state->setRedirect('quicktabs.admin');
    }
    $this->messenger
        ->addStatus($this->t('Your changes have been saved.'));
    drupal_flush_all_caches();
}