You are here

function mediafront_preset_export_form in MediaFront 7.2

Same name and namespace in other branches
  1. 6.2 includes/mediafront.preset.inc \mediafront_preset_export_form()
  2. 6 includes/mediafront.preset.inc \mediafront_preset_export_form()
  3. 7 includes/mediafront.preset.inc \mediafront_preset_export_form()

The preset export form.

1 string reference to 'mediafront_preset_export_form'
mediafront_preset_menu in includes/mediafront.preset.inc
Implement the menu system for the preset.

File

includes/mediafront.preset.inc, line 492

Code

function mediafront_preset_export_form($form, &$form_state, $preset) {

  // Unset the unnecessary elements.
  unset($preset['pid']);
  unset($preset['default']);

  // Get the code string representation.
  $code = var_export($preset, true);

  // Make sure to format the arrays like drupal.
  $code = str_replace("=> \n  ", '=> ', $code);

  // Add the preset variable.
  $code = '$preset = ' . $code . ';';
  $lines = substr_count($code, "\n");
  $form['export'] = array(
    '#title' => t('Export Preset'),
    '#type' => 'textarea',
    '#value' => $code,
    '#rows' => $lines,
    '#description' => t('Copy the export text and paste it into another preset using the import function.'),
  );

  // Return the form.
  return $form;
}