You are here

function avatar_selection_menu in Avatar Selection 5.2

Same name and namespace in other branches
  1. 5 avatar_selection.module \avatar_selection_menu()
  2. 6 avatar_selection.module \avatar_selection_menu()
  3. 7 avatar_selection.module \avatar_selection_menu()

Implementation of hook_menu().

File

./avatar_selection.module, line 54
The Avatar Selection module allows the user to pick an avatar image from a list already loaded by an administrative user, and to the administrator to disable uploading other avatar files by the user.

Code

function avatar_selection_menu($may_cache) {
  $access = user_access('administer avatar selection');
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/avatar_selection',
      'title' => t('Avatar Selection'),
      'callback' => 'avatar_selection_settings_page',
      'access' => $access,
      'description' => t('Allows the user to upload and delete avatars.'),
    );
    $items[] = array(
      'path' => 'admin/settings/avatar_selection/config',
      'title' => t('Configure'),
      'description' => t('Allows the user to configure avatar settings.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'avatar_selection_config_form',
      ),
      'access' => $access,
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    $items[] = array(
      'path' => 'admin/settings/avatar_selection/upload',
      'title' => t('Upload'),
      'description' => t('Allows the user to upload avatars.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'avatar_selection_upload_form',
      ),
      'access' => $access,
      'type' => MENU_LOCAL_TASK,
      'weight' => -9,
    );
    $items[] = array(
      'path' => 'admin/settings/avatar_selection/edit',
      'title' => t('Manage avatars'),
      'description' => t('Allows the user to modify or delete an avatar from a list.'),
      'callback' => 'avatar_selection_roles_page',
      'callback arguments' => NULL,
      'access' => $access,
      'type' => MENU_LOCAL_TASK,
    );
    if (arg(0) == 'admin' && arg(1) == 'settings' && arg(2) == 'avatar_selection' && arg(3) == 'edit') {
      if ((arg(4) == 'role' || arg(4) == 'og') && is_numeric(arg(5))) {
        $items[] = array(
          'path' => 'admin/settings/avatar_selection/edit/' . arg(4) . '/' . arg(5),
          'title' => t('Manage avatars'),
          'description' => t('Allows the user to modify or delete an avatar from a list.'),
          'callback' => 'avatar_selection_roles_page',
          'callback arguments' => array(
            'op' => 'list',
          ),
          'access' => $access,
        );
      }
    }
  }
  return $items;
}