public function YamlFormResultsCustomForm::submitForm in YAML Form 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 FormInterface::submitForm
File
- src/
Form/ YamlFormResultsCustomForm.php, line 277
Class
- YamlFormResultsCustomForm
- Form for form results custom(ize) form.
Namespace
Drupal\yamlform\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Set columns.
$this->yamlform
->setState($this
->getStateKey('columns'), $form_state
->getValue('columns'));
// Set sort, direction, limit.
$this->yamlform
->setState($this
->getStateKey('sort'), $form_state
->getValue('sort'));
$this->yamlform
->setState($this
->getStateKey('direction'), $form_state
->getValue('direction'));
$this->yamlform
->setState($this
->getStateKey('limit'), (int) $form_state
->getValue('limit'));
$this->yamlform
->setState($this
->getStateKey('format'), $form_state
->getValue('format'));
// Set default.
if (empty($this->sourceEntity)) {
$this->yamlform
->setState($this
->getStateKey('default'), $form_state
->getValue('default'));
}
// Display message.
drupal_set_message($this
->t('The customized table has been saved.'));
// Set redirect.
$route_name = $this->requestHandler
->getRouteName($this->yamlform, $this->sourceEntity, 'yamlform.results_table');
$route_parameters = $this->requestHandler
->getRouteParameters($this->yamlform, $this->sourceEntity);
$form_state
->setRedirect($route_name, $route_parameters);
}