You are here

function tac_lite_menu in Taxonomy Access Control Lite 5

Same name and namespace in other branches
  1. 6 tac_lite.module \tac_lite_menu()
  2. 7 tac_lite.module \tac_lite_menu()

Implementation of hook_menu().

File

./tac_lite.module, line 40
Control access to site content based on taxonomy, roles and users.

Code

function tac_lite_menu($may_cache) {
  global $user;
  $items = array();
  $admin_access = user_access('administer_tac_lite');
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/user/tac_lite',
      'title' => t('Access control by taxonomy'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'tac_lite_admin_settings',
      'type' => MENU_NORMAL_ITEM,
      'weight' => 1,
      // after 'roles' tab
      'access' => $admin_access,
    );
    $items[] = array(
      'path' => 'admin/user/tac_lite/settings',
      'title' => t('Settings'),
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -1,
      'access' => $admin_access,
    );
  }
  else {
    if (arg(0) == 'admin' && arg(1) == 'user' && arg(2) == 'tac_lite') {
      $schemes = variable_get('tac_lite_schemes', 1);
      for ($i = 1; $i <= $schemes; $i++) {
        $items[] = array(
          'path' => 'admin/user/tac_lite/scheme/' . $i,
          'title' => t('Scheme !num', array(
            '!num' => $i,
          )),
          'callback' => 'tac_lite_admin_settings_scheme',
          'callback arguments' => $i,
          'type' => MENU_LOCAL_TASK,
          'access' => $admin_access,
        );
      }
    }
  }
  return $items;
}