/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $form_state->cleanValues(); // The tab configuration is stored in the 'data' key in the form, // pass that through for submission. $tab_data = (new FormState())->setValues($form_state->getValue('data')); $this->tab->submitConfigurationForm($form, $tab_data); // Update the original form values. $form_state->setValue('data', $tab_data->getValues()); $this->tab->setTitle($form_state->getValue('title')); $this->tab->setWeight($form_state->getValue('weight')); if (!$this->tab->getUuid()) { $this->blocktabs->addTab($this->tab->getConfiguration()); } $this->blocktabs->save(); drupal_set_message($this->t('The tab was successfully applied.')); $form_state->setRedirectUrl($this->blocktabs->urlInfo('edit-form')); }
/** * {@inheritdoc} */ public function deleteTab(TabInterface $tab) { $this->getTabs()->removeInstanceId($tab->getUuid()); $this->save(); return $this; }