You are here

function imageapi_menu in ImageAPI 5

Same name and namespace in other branches
  1. 6 imageapi.module \imageapi_menu()

Implementation of hook_menu().

File

./imageapi.module, line 26
An ImageAPI supporting mulitple image toolkits. Image toolkits are implemented as modules. Images are objects, but have no methods

Code

function imageapi_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/imageapi',
      'title' => t('ImageAPI'),
      'description' => t('Configure ImageAPI.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'imageapi_settings',
      ),
    );
  }
  else {
    $toolkits = imageapi_get_available_toolkits();
    if ($toolkits) {
      $items[] = array(
        'path' => 'admin/settings/imageapi/list',
        'title' => 'List',
        'type' => MENU_DEFAULT_LOCAL_TASK,
        'weight' => -1,
      );
      $items[] = array(
        'path' => 'admin/settings/imageapi/config',
        'title' => 'Configure',
        'type' => MENU_LOCAL_TASK,
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          imageapi_default_toolkit() . '_settings_form',
        ),
      );
      foreach ($toolkits as $module => $info) {
        $items[] = array(
          'path' => 'admin/settings/imageapi/config/' . $module,
          'title' => $info['name'],
          'callback' => 'drupal_get_form',
          'callback arguments' => array(
            $module . '_settings_form',
          ),
          'type' => $module == imageapi_default_toolkit() ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
        );
      }
    }
  }
  return $items;
}