You are here

function imagecache_ui_preset_export_form in ImageCache 6.2

Imagecache preset export form.

1 string reference to 'imagecache_ui_preset_export_form'
imagecache_ui_menu in ./imagecache_ui.module
Implementation of hook_menu().

File

./imagecache_ui.pages.inc, line 99

Code

function imagecache_ui_preset_export_form(&$form_state, $preset = array()) {
  if (empty($preset)) {
    drupal_set_message(t('The specified preset was not found'), 'error');
    $form_state['redirect'] = 'admin/build/imagecache';
  }
  if (isset($preset['presetid'])) {
    unset($preset['presetid']);
  }
  if (isset($preset['storage'])) {
    unset($preset['storage']);
  }
  foreach ($preset['actions'] as $id => $action) {
    unset($preset['actions'][$id]['actionid']);
    unset($preset['actions'][$id]['presetid']);
  }
  $exported = '$presets = array();';
  $exported .= "\n";
  $exported .= '$presets[\'' . $preset['presetname'] . '\'] = ';
  $exported .= var_export($preset, TRUE) . ';';
  $rows = substr_count($exported, "\n") + 1;
  $form = array();
  $form['export'] = array(
    '#type' => 'textarea',
    '#default_value' => $exported,
    '#rows' => $rows,
    '#resizable' => FALSE,
  );
  return $form;
}