You are here

function imageapi_menu in ImageAPI 6

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

Implementation of hook_menu().

File

./imageapi.module, line 28
An ImageAPI supporting additional image plugins as modules. Images are treated as objects, and images are not written per manipulation as Drupal's core image handling works.

Code

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