You are here

function imagecache_admin in ImageCache 5

1 string reference to 'imagecache_admin'
imagecache_menu in ./imagecache.module
Implementation of hook_menu().

File

./imagecache.module, line 371
Dynamic image resizer and image cacher.

Code

function imagecache_admin() {
  drupal_set_title('Imagecache administration');
  $form = array();
  $form['title'] = array(
    '#type' => 'markup',
    '#value' => t('Imagecache presets'),
  );
  $form['presets']['#tree'] = TRUE;
  $presets = _imagecache_get_presets();
  foreach ($presets as $presetid => $presetname) {
    $form['presets'][$presetid] = array(
      '#type' => 'fieldset',
      '#title' => $presetname,
      '#collapsible' => TRUE,
      '#collapsed' => arg(4) != $presetid,
    );
    $form['presets'][$presetid]['name'] = array(
      '#type' => 'textfield',
      '#title' => t('Preset namespace'),
      '#default_value' => $presetname,
      '#description' => t('String that will be used as an identifier in the url for this set of handlers. Final urls will look like http://example.com/files/imagecache/%namespace/<path to orig>', array(
        '%namespace' => $presetname,
      )),
    );
    $form['presets'][$presetid]['handlers'] = array(
      '#type' => 'fieldset',
      '#title' => t('Image handlers'),
    );
    $form['presets'][$presetid]['handlers']['#tree'] = FALSE;
    $form['presets'][$presetid]['handlers'] = _imagecache_actions_form($presetid);
    $form['presets'][$presetid]['ops']['#tree'] = FALSE;
    $form['presets'][$presetid]['ops']['update'] = array(
      '#type' => 'submit',
      '#name' => 'preset-op[' . $presetid . ']',
      '#value' => t('Update preset'),
    );
    $form['presets'][$presetid]['ops']['delete'] = array(
      '#type' => 'submit',
      '#name' => 'preset-op[' . $presetid . ']',
      '#value' => t('Delete preset'),
    );
    $form['presets'][$presetid]['ops']['flush'] = array(
      '#type' => 'submit',
      '#name' => 'preset-op[' . $presetid . ']',
      '#value' => t('Flush preset images'),
    );
  }
  $form['presets']['new'] = array(
    '#type' => 'fieldset',
    '#title' => t('New preset'),
    '#tree' => TRUE,
  );
  $form['presets']['new']['name'] = array(
    '#type' => 'textfield',
    '#size' => '64',
    '#title' => t('Preset namespace'),
    '#default_value' => '',
    '#description' => t('The namespace of an imagecache preset. It represents a series of actions to be performed when imagecache dynamically generates an image. This will also be used in the url for images. Please no spaces.'),
  );
  $form['presets']['new']['create'] = array(
    '#type' => 'submit',
    '#name' => 'preset-op[new]',
    '#value' => t('Create preset'),
    '#weight' => 10,
  );
  return $form;
}