function ConfigFormBase::copyFormValuesToConfig
Same name in other branches
- 10 core/lib/Drupal/Core/Form/ConfigFormBase.php \Drupal\Core\Form\ConfigFormBase::copyFormValuesToConfig()
Copies form values to Config keys.
This should not change existing Config key-value pairs that are not being edited by this form.
Parameters
\Drupal\Core\Config\Config $config: The configuration being edited.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
array $form: The form array.
See also
\Drupal\Core\Entity\EntityForm::copyFormValuesToEntity()
2 calls to ConfigFormBase::copyFormValuesToConfig()
- ConfigFormBase::submitForm in core/
lib/ Drupal/ Core/ Form/ ConfigFormBase.php - ConfigFormBase::validateForm in core/
lib/ Drupal/ Core/ Form/ ConfigFormBase.php
File
-
core/
lib/ Drupal/ Core/ Form/ ConfigFormBase.php, line 329
Class
- ConfigFormBase
- Base class for implementing system configuration forms.
Namespace
Drupal\Core\FormCode
private static function copyFormValuesToConfig(Config $config, FormStateInterface $form_state, array $form) : void {
$map = $form_state->get(static::CONFIG_KEY_TO_FORM_ELEMENT_MAP);
foreach ($map[$config->getName()] as $array_parents) {
$target = ConfigTarget::fromForm($array_parents, $form);
if ($target->configName !== $config->getName()) {
continue;
}
$value = $form_state->getValue($target->elementParents);
$target->setValue($config, $value, $form_state);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.