You are here

function values_export_values in Values 6

Same name and namespace in other branches
  1. 7 values.module \values_export_values()

Export a value list and display it in a form.

1 string reference to 'values_export_values'
values_menu in ./values.module
Implementation of hook_menu().

File

./values.module, line 481
API for managing reusable value sets.

Code

function values_export_values(&$form_state, $values) {
  if (!module_exists('ctools')) {
    return array(
      'message' => array(
        '#value' => t('For exporting capabilities, please install the !ctools module.', array(
          '!ctools' => l('Chaos tools suite', 'http://drupal.org/project/ctools'),
        )),
      ),
    );
  }
  drupal_set_title(check_plain($values->description));
  $code = values_export($values);
  $lines = substr_count($code, "\n");
  $form['export'] = array(
    '#title' => t('Export data'),
    '#type' => 'textarea',
    '#value' => $code,
    '#rows' => $lines,
    '#description' => t('Copy the export text and paste it into another value list using the import function.'),
  );
  return $form;
}