public function ConfigSingleExportForm::updateExport in Drupal 9
Same name and namespace in other branches
- 8 core/modules/config/src/Form/ConfigSingleExportForm.php \Drupal\config\Form\ConfigSingleExportForm::updateExport()
Handles switching the export textarea.
1 call to ConfigSingleExportForm::updateExport()
- ConfigSingleExportForm::buildForm in core/
modules/ config/ src/ Form/ ConfigSingleExportForm.php - Form constructor.
File
- core/
modules/ config/ src/ Form/ ConfigSingleExportForm.php, line 146
Class
- ConfigSingleExportForm
- Provides a form for exporting a single configuration file.
Namespace
Drupal\config\FormCode
public function updateExport($form, FormStateInterface $form_state) {
// Determine the full config name for the selected config entity.
if ($form_state
->getValue('config_type') !== 'system.simple') {
$definition = $this->entityTypeManager
->getDefinition($form_state
->getValue('config_type'));
$name = $definition
->getConfigPrefix() . '.' . $form_state
->getValue('config_name');
}
else {
$name = $form_state
->getValue('config_name');
}
// Read the raw data for this config name, encode it, and display it.
$form['export']['#value'] = Yaml::encode($this->configStorage
->read($name));
$form['export']['#description'] = $this
->t('Filename: %name', [
'%name' => $name . '.yml',
]);
return $form['export'];
}