protected function WebformHandlerBase::applyFormStateToConfiguration in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformHandlerBase.php \Drupal\webform\Plugin\WebformHandlerBase::applyFormStateToConfiguration()
Apply submitted form state to configuration.
This method can used to update configuration when the configuration form is being rebuilt during an #ajax callback.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
9 calls to WebformHandlerBase::applyFormStateToConfiguration()
- ActionWebformHandler::submitConfigurationForm in src/
Plugin/ WebformHandler/ ActionWebformHandler.php - Form submission handler.
- DebugWebformHandler::submitConfigurationForm in src/
Plugin/ WebformHandler/ DebugWebformHandler.php - Form submission handler.
- EmailWebformHandler::buildConfigurationForm in src/
Plugin/ WebformHandler/ EmailWebformHandler.php - Form constructor.
- EmailWebformHandler::validateConfigurationForm in src/
Plugin/ WebformHandler/ EmailWebformHandler.php - Form validation handler.
- OptionsLimitWebformHandler::buildConfigurationForm in modules/
webform_options_limit/ src/ Plugin/ WebformHandler/ OptionsLimitWebformHandler.php - Form constructor.
File
- src/
Plugin/ WebformHandlerBase.php, line 536
Class
- WebformHandlerBase
- Provides a base class for a webform handler.
Namespace
Drupal\webform\PluginCode
protected function applyFormStateToConfiguration(FormStateInterface $form_state) {
$values = $form_state
->getValues();
$default_configuration = $this
->defaultConfiguration();
foreach ($values as $key => $value) {
if (array_key_exists($key, $this->configuration)) {
if (is_bool($default_configuration[$key])) {
$this->configuration[$key] = (bool) $value;
}
elseif (is_int($default_configuration[$key])) {
$this->configuration[$key] = (int) $value;
}
else {
$this->configuration[$key] = $value;
}
}
}
}