You are here

function smileys_menu in Smileys 5

Same name and namespace in other branches
  1. 6 smileys.module \smileys_menu()

Implementation of hook_menu().

File

./smileys.module, line 203

Code

function smileys_menu($may_cache) {
  $items = array();

  // Add the JS and CSS
  $path = drupal_get_path('module', 'smileys');
  drupal_add_js($path . '/smileys.js');
  drupal_add_css($path . '/smileys.css');
  drupal_add_js(array(
    'smileys' => array(
      'basePath' => base_path() . (variable_get('clean_url', 0) ? '' : '?q='),
    ),
  ), 'setting');
  if ($may_cache) {
    $access = user_access('administer smileys');
    $items[] = array(
      'path' => 'admin/settings/smileys',
      'title' => t('Smileys'),
      'description' => t('Manage Smileys and toggle select box behavior for nodes and comments.'),
      'callback' => 'smileys_admin_list',
      'access' => $access,
    );
    $items[] = array(
      'path' => 'admin/settings/smileys/list',
      'title' => t('List'),
      'callback' => 'smileys_admin_list',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/settings/smileys/add',
      'title' => t('Add'),
      'callback' => 'smileys_admin_add',
      'access' => $access,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/smileys/configure',
      'title' => t('Settings'),
      'description' => t('Smileys configuration.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => 'smileys_admin_settings',
      'access' => user_access('administer smileys'),
      'weight' => 8,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/smileys/edit',
      'title' => t('Edit smiley'),
      'callback' => 'smileys_admin_add',
      'access' => $access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/smileys/delete',
      'title' => t('Delete smiley'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'smileys_admin_delete_confirm',
      ),
      'access' => $access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'admin/settings/smileys/promote',
      'callback' => 'smileys_promote_handle',
      'access' => $access,
      'type' => MENU_CALLBACK,
    );
    $items[] = array(
      'path' => 'smileys/fetch',
      'callback' => 'smileys_list',
      'access' => user_access('use smiley select box'),
      'type' => MENU_CALLBACK,
    );
  }
  return $items;
}