You are here

function imagepicker_menu in Image Picker 5

Same name and namespace in other branches
  1. 5.2 imagepicker.module \imagepicker_menu()
  2. 6.2 imagepicker.module \imagepicker_menu()
  3. 7 imagepicker.module \imagepicker_menu()

Implementation of hook_menu().

File

./imagepicker.module, line 38
Enables permitted roles to upload images for insertion into configured nodes.

Code

function imagepicker_menu($may_cache) {
  global $user;
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'imagepicker',
      'title' => t('Image picker'),
      'callback' => 'imagepicker_upload',
      'access' => user_access('use imagepicker'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'imagepicker/upload',
      'title' => t('Upload'),
      'access' => user_access('use imagepicker'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => 1,
    );
    $items[] = array(
      'path' => 'imagepicker/browse',
      'title' => t('Browse'),
      'callback' => 'imagepicker_browse',
      'access' => user_access('use imagepicker'),
      'type' => MENU_LOCAL_TASK,
      'weight' => 2,
    );
    $items[] = array(
      'path' => 'imagepicker/edit',
      'title' => t('Edit image'),
      'callback' => 'imagepicker_image_edit',
      'access' => user_access('use imagepicker'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'imagepicker/image',
      'title' => t('Imagepicker'),
      'callback' => 'imagepicker_image_page',
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );

    // admin settings
    $items[] = array(
      'path' => 'admin/settings/imagepicker',
      'title' => t('Imagepicker'),
      'description' => t('Imagepicker settings.'),
      'access' => user_access('administer imagepicker'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'imagepicker_settings',
      'type' => MENU_NORMAL_ITEM,
    );
  }

  // in my account
  if (variable_get('imagepicker_account_enabled', 1)) {
    $items[] = array(
      'path' => 'user/' . $user->uid . '/imagepicker',
      'title' => t('My imagepicker'),
      'description' => t('Manage your imagepicker files.'),
      'callback' => 'imagepicker_user_page',
      'access' => user_access('access own imagepicker'),
      'type' => MENU_LOCAL_TASK,
    );
  }
  return $items;
}