You are here

function imagecache_ui_menu in ImageCache 5.2

Same name and namespace in other branches
  1. 6.2 imagecache_ui.module \imagecache_ui_menu()

File

./imagecache_ui.module, line 14

Code

function imagecache_ui_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/build/imagecache',
      'title' => t('Imagecache'),
      'description' => t('Administer imagecache presets and actions.'),
      'callback' => 'imagecache_ui_presets',
      'access' => user_access('administer imagecache'),
    );
    $items[] = array(
      'path' => 'admin/build/imagecache/list',
      'title' => t('List'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/build/imagecache/add',
      'title' => t('Add New Preset'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'imagecache_ui_preset_add_form',
      ),
      'access' => user_access('administer imagecache'),
      'type' => MENU_LOCAL_TASK,
    );
  }
  elseif (arg(0) == 'admin' && arg(1) == 'build' && arg(2) == 'imagecache' && arg(3) == 'preset') {
    $preset = imagecache_preset(arg(4));
    if (empty($preset)) {
      return $items;
    }
    $t = array(
      '!presetname' => $preset['presetname'],
    );
    $items[] = array(
      'path' => 'admin/build/imagecache/preset/' . arg(4) . '/delete',
      'title' => t('Delete Preset: !presetname', $t),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'imagecache_ui_preset_delete_form',
        arg(4),
      ),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/imagecache/preset/' . arg(4) . '/flush',
      'title' => t('Flush Preset: !presetname', $t),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'imagecache_ui_preset_flush_form',
        arg(4),
      ),
      'access' => user_access('flush imagecache'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/imagecache/preset/' . arg(4),
      'title' => t('!presetname', $t),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'imagecache_ui_preset_form',
        arg(4),
      ),
      'type' => MENU_CALLBACK,
    );
    $definition = imagecache_action_definition(arg(7));
    if (!empty($definition)) {
      $t['!action'] = $definition['name'];
      $items[] = array(
        'path' => 'admin/build/imagecache/preset/' . arg(4) . '/action/add/' . arg(7),
        'title' => t('Add !action to !presetname', $t),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'imagecache_ui_action_add_form',
          arg(4),
          arg(7),
        ),
        'type' => MENU_CALLBACK,
      );
    }
    $action = imagecache_action(arg(6));
    if ($action) {
      $t['!action'] = $action['name'];
      $items[] = array(
        'path' => 'admin/build/imagecache/preset/' . arg(4) . '/action/' . arg(6),
        'title' => t('!action for preset !presetname', $t),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'imagecache_ui_action_form',
          arg(6),
        ),
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'admin/build/imagecache/preset/' . arg(4) . '/action/' . arg(6) . '/delete',
        'title' => t('Delete !action for preset !presetname', $t),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'imagecache_ui_action_delete_form',
          arg(4),
          arg(6),
        ),
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}