You are here

function imagecache_ui_action_form in ImageCache 6.2

Same name and namespace in other branches
  1. 5.2 imagecache_ui.module \imagecache_ui_action_form()
2 string references to 'imagecache_ui_action_form'
imagecache_ui_action_add_page in ./imagecache_ui.pages.inc
Page with form for adding a new action to add to a preset.
imagecache_ui_menu in ./imagecache_ui.module
Implementation of hook_menu().

File

./imagecache_ui.pages.inc, line 371

Code

function imagecache_ui_action_form($form_state, $preset, $action) {

  // Do some error checking.
  if (empty($preset['presetid'])) {
    drupal_set_message(t('Unknown preset.'), 'error');
    drupal_goto('admin/build/imagecache');
  }
  if (empty($action['action']) || !($definition = imagecache_action_definition($action['action']))) {
    drupal_set_message(t('Unknown action.'), 'error');
    drupal_goto('admin/build/imagecache/' . $preset['presetid']);
  }
  if ($action['presetid'] != $preset['presetid']) {
    drupal_set_message(t('This %action action is not associated %preset preset.', array(
      '%action' => $action['action'],
      '%preset' => $preset['presetname'],
    )), 'error');
    drupal_goto('admin/build/imagecache/' . $preset['presetid']);
  }
  $form['#tree'] = TRUE;
  $form['presetid'] = array(
    '#type' => 'value',
    '#value' => $action['presetid'],
  );
  $form['actionid'] = array(
    '#type' => 'value',
    '#value' => isset($action['actionid']) ? $action['actionid'] : '',
  );
  $form['action'] = array(
    '#type' => 'value',
    '#value' => $action['action'],
  );
  if (!empty($definition['file'])) {
    require_once $definition['file'];
  }
  if (function_exists($action['action'] . '_form')) {
    $form['data'] = call_user_func($action['action'] . '_form', $action['data']);
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => empty($action['actionid']) ? t('Create Action') : t('Update Action'),
  );
  return $form;
}