You are here

public function ConfigSingleExportForm::updateExport in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 144
Contains \Drupal\config\Form\ConfigSingleExportForm.

Class

ConfigSingleExportForm
Provides a form for exporting a single configuration file.

Namespace

Drupal\config\Form

Code

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->entityManager
      ->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', array(
    '%name' => $name . '.yml',
  ));
  return $form['export'];
}