You are here

function img_assist_menu in Image Assist 5

Same name and namespace in other branches
  1. 5.3 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'),
      'access' => $ia_access,
      'type' => MENU_CALLBACK,
      'callback' => 'img_assist_insert_html',
    );
    $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 {
    $path = drupal_get_path('module', 'img_assist');
    if (variable_get('img_assist_page_styling', 'yes') == 'yes') {
      drupal_add_css($path . '/img_assist.css');
    }

    // Assign base_path to insert in image source by javascript.
    drupal_add_js('var BASE_URL = "' . base_path() . '";', 'inline');
    drupal_add_js($path . '/img_assist.js');
  }
  return $items;
}