Corrected the menu system
enboig - June 20, 2008 - 16:19
| Project: | Answers |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | enboig |
| Status: | closed |
Description
I have corrected the menu system so tabs are generated by drupal. I don't know how to make a patch, but the menu hook looks like:
<?php
function answers_menu($may_cache) {
$items = array();
$nid = (int)arg(1);
global $user;
if ($may_cache) {
$items[] = array(
'path' => 'quest/list',
'callback' => 'answers_list',
'title' => t('Browse Quests'),
'access' => user_access('access content'),
'type' => MENU_NORMAL_ITEM);
$items[] = array(
'path' => 'quest/list/ans',
'callback' => 'answers_list',
'callback arguments' => array(0),
'title' => t('Browse Quests'),
'type' => MENU_DEFAULT_LOCAL_TASK);
$items[] = array(
'path' => 'quest/list/uans',
'callback' => 'answers_list',
'title' => t('Unanswered Quests'),
'access' => user_access('access content'),
'type' => MENU_LOCAL_TASK);
}
$items[] = array(
'path' => 'admin/settings/answers',
'callback' => 'drupal_get_form',
'callback arguments' => array('answers_settings'),
'title' => t('Answers settings'),
'description' => t('Configure Answers service settings'),
'access' => user_access('administer content types'),
'type' => MENU_NORMAL_ITEM
);
return $items;
}
?>And answers_list() like this:
<?php
function answers_list () {
$ansset = 'active';
if (arg(2)=='uans') {
$ansset = '';
$unanset = 'active';
$filteranswered = TRUE;
}
return $o = theme('answers_list', $filteranswered);
}
?>I would like to make unanswered questions just available to some users, but I don't have time right now to implement this (maybe later).
