You are here

function img_assist_menu in Image Assist 5.3

Same name and namespace in other branches
  1. 5 img_assist.module \img_assist_menu()
  2. 5.2 img_assist.module \img_assist_menu()
  3. 6.2 img_assist.module \img_assist_menu()
  4. 6 img_assist.module \img_assist_menu()

Implementation of hook_menu().

File

./img_assist.module, line 28
Image Assist module

Code

function img_assist_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $admin_access = user_access('administer site configuration');
    $ia_access = user_access('access img_assist');
    $items[] = array(
      'path' => 'img_assist/cache/clear',
      'title' => t('Empty cache'),
      'callback' => 'img_assist_cache_clear',
      'access' => $admin_access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'img_assist/load',
      'title' => t('Image assist'),
      'callback' => 'img_assist_loader',
      'access' => $ia_access,
      'type' => MENU_CALLBACK,
    );

    // Page callbacks called internally by img_assist/load.
    $items[] = array(
      'path' => 'img_assist/header',
      'title' => t('Image assist header'),
      'callback' => 'img_assist_header',
      'access' => $ia_access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'img_assist/thumbs',
      'title' => t('Image assist thumbnails'),
      'callback' => 'img_assist_thumbs',
      'access' => $ia_access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'img_assist/upload',
      'title' => t('Image assist upload'),
      'callback' => 'img_assist_upload',
      'access' => $ia_access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'img_assist/properties',
      'title' => t('Image assist properties'),
      'callback' => 'img_assist_properties',
      'access' => $ia_access,
      'type' => MENU_CALLBACK,
    );

    // Popup images page.
    $items[] = array(
      'path' => 'img_assist/popup',
      'title' => t('Popup image'),
      'callback' => 'img_assist_popup',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );

    // Insert callback (only for inserting HTML, not filter tag).
    $items[] = array(
      'path' => 'img_assist/insert_html',
      'title' => t('Insert callback'),
      'callback' => 'img_assist_insert_html',
      'access' => $ia_access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/img_assist',
      'title' => t('Image assist'),
      'description' => t('Change settings for the Image assist module.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'img_assist_admin_settings',
      'access' => $admin_access,
    );
  }
  else {

    // Ensure Drupal.settings.basePath on all pages (including popup window).
    drupal_add_js(array(
      'basePath' => base_path(),
    ), 'setting');
    $path = drupal_get_path('module', 'img_assist');
    if (arg(0) == 'img_assist') {

      // Suppress Administration menu.
      module_invoke('admin_menu', 'suppress');
      drupal_add_css($path . '/img_assist_popup.css', 'module', 'all', FALSE);
    }
    else {
      drupal_add_js($path . '/img_assist.js');
      if (variable_get('img_assist_page_styling', 'yes') == 'yes') {
        drupal_add_css($path . '/img_assist.css');
      }
    }
  }
  return $items;
}