public function QuickTabsInstanceEditForm::save in Quick Tabs 8.3
Form submission handler for the 'save' action.
Normally this method should be overridden to provide specific messages to the user and redirect the form after the entity has been saved.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
int Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.
Overrides EntityForm::save
File
- src/
Form/ QuickTabsInstanceEditForm.php, line 289
Class
- QuickTabsInstanceEditForm
- Class QuickTabsInstanceEditForm.
Namespace
Drupal\quicktabs\FormCode
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();
}