public function YamlFormOptionsForm::save in YAML Form 8
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/
YamlFormOptionsForm.php, line 178
Class
- YamlFormOptionsForm
- Provides a form to set options.
Namespace
Drupal\yamlformCode
public function save(array $form, FormStateInterface $form_state) {
/** @var \Drupal\yamlform\YamlFormOptionsInterface $yamlform_options */
$yamlform_options = $this
->getEntity();
$yamlform_options
->save();
$this
->logger('yamlform')
->notice('Options @label saved.', [
'@label' => $yamlform_options
->label(),
]);
drupal_set_message($this
->t('Options %label saved.', [
'%label' => $yamlform_options
->label(),
]));
$form_state
->setRedirect('entity.yamlform_options.collection');
}