public function SettingsForm::submitForm in Node Option Premium 8
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides ConfigFormBase::submitForm
File
- src/
Form/ SettingsForm.php, line 147
Class
- SettingsForm
- Defines a form that configures settings.
Namespace
Drupal\nopremium\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
$this
->config('nopremium.settings')
->set('default_message', $values['default_message'])
->set('view_modes', array_filter($values['view_modes']))
->set('teaser_view_mode', $values['teaser_view_mode'])
->save();
foreach ($this->entityTypeManager
->getStorage('node_type')
->loadMultiple() as $content_type) {
$this
->config('nopremium.settings')
->set('messages.' . $content_type
->id(), $values['message_' . $content_type
->id()])
->save();
}
parent::submitForm($form, $form_state);
}