1 config.admin.inc config_export_single_form_update_export($form, &$form_state)

AJAX submit handler for config_export_single_form().

Handles switching the export textarea.

File

core/modules/config/config.admin.inc, line 385
Admin page callbacks for the Configuration Management module.

Code

function config_export_single_form_update_export($form, &$form_state) {
  if ($form_state['values']['config_name']) {
    $config_name = $form_state['values']['config_name'];
    $storage = config_get_config_storage('active');
    $config = new Config($config_name, $storage);

    // Re-add the config name property so it shows up in the export.
    $data = array_merge(array('_config_name' => $config_name), $config->get());
    $value = $storage->encode($data);
    $row_count = substr_count($value, "\n");
    $form['export']['#value'] = $value;
    $form['export']['#rows'] = $row_count > 12 ? $row_count : 12;
  }
  else {
    $form['export']['#value'] = '';
    $form['export']['#rows'] = 12;
  }
  return $form['export'];
}