You are here

function textimage_menu in Textimage 5.2

Same name and namespace in other branches
  1. 5 textimage.module \textimage_menu()
  2. 6.2 textimage.module \textimage_menu()
  3. 7.3 textimage.module \textimage_menu()
  4. 7.2 textimage.module \textimage_menu()

Implementation of hook_menu().

File

./textimage.module, line 107

Code

function textimage_menu($may_cache) {
  $items = array();
  if (!$may_cache) {

    // Only include administrative callbacks if we are viewing an admin page.
    if (arg(0) == 'admin') {
      include_once './' . drupal_get_path('module', 'textimage') . '/textimage_admin.inc';
    }
  }
  if ($may_cache) {
    $items[] = array(
      'path' => file_directory_path() . '/textimage',
      'callback' => 'textimage_image',
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/textimage',
      'title' => t('Textimage'),
      'description' => t('Configure text to image preset functions.'),
      'callback' => 'textimage_preset_list',
      'access' => user_access('administer site configuration'),
      'type' => MENU_NORMAL_ITEM,
    );
    $items[] = array(
      'path' => 'admin/build/textimage/preset',
      'title' => t('Presets'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/build/textimage/preset/list',
      'title' => t('List'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/build/textimage/preset/new',
      'title' => t('New'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_preset_edit',
        'new',
      ),
      'access' => user_access('administer site configuration'),
      'weight' => 2,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/build/textimage/settings',
      'title' => t('Settings'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_settings_form',
      ),
      'access' => user_access('administer site configuration'),
      'weight' => 10,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'js/textimage',
      'callback' => 'textimage_js',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK,
    );
  }
  else {
    $items[] = array(
      'path' => 'admin/build/textimage/preset/' . arg(4) . '/edit',
      'title' => t('Edit Preset'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_preset_edit',
        'edit',
        arg(4),
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/textimage/preset/' . arg(4) . '/delete',
      'title' => t('Edit Preset'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_preset_delete_confirm',
        arg(4),
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/build/textimage/preset/' . arg(4) . '/flush',
      'title' => t('Flush Preset Cache'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'textimage_preset_flush_confirm',
        arg(4),
      ),
      'access' => user_access('administer site configuration'),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}