function fivestar_menu in Fivestar 6.2
Same name and namespace in other branches
- 5 fivestar.module \fivestar_menu()
- 6 fivestar.module \fivestar_menu()
- 7.2 fivestar.module \fivestar_menu()
Implementation of hook_menu().
File
- ./
fivestar.module, line 35 - A simple n-star voting widget, usable in other forms.
Code
function fivestar_menu() {
$items = array();
$items['admin/settings/fivestar'] = array(
'title' => 'Fivestar',
'description' => 'Configure site-wide widgets used for Fivestar rating.',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'fivestar_settings',
),
'access callback' => 'user_access',
'access arguments' => array(
'administer site configuration',
),
'type' => MENU_NORMAL_ITEM,
'file' => 'includes/fivestar.admin.inc',
);
$items['fivestar/preview/node'] = array(
'page callback' => 'fivestar_preview',
'access callback' => 'user_access',
'access arguments' => array(
'administer content types',
),
'type' => MENU_CALLBACK,
'file' => 'includes/fivestar.admin.inc',
);
$items['fivestar/preview/color'] = array(
'page callback' => 'fivestar_preview_color',
'access callback' => 'user_access',
'access arguments' => array(
'administer site configuration',
),
'type' => MENU_CALLBACK,
'file' => 'includes/fivestar.color.inc',
);
$items['fivestar/vote'] = array(
'page callback' => 'fivestar_vote',
'access callback' => 'user_access',
'access arguments' => array(
'rate content',
),
'type' => MENU_CALLBACK,
);
// Add a "fivestar" tab to each content type.
// We can't yet add it to the "operations" column in content types, due to a TODO in CCK
// (content.admin.inc line 32)
foreach (node_get_types() as $type) {
$type_name = $type->type;
$type_url_str = str_replace('_', '-', $type_name);
$items['admin/content/node-type/' . $type_url_str . '/fivestar'] = array(
'title' => 'Fivestar voting',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'fivestar_node_type_tag_form',
$type_name,
),
'access arguments' => array(
'administer content types',
),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
'file' => 'includes/fivestar.admin.inc',
);
foreach (fivestar_get_tags() as $tag) {
$items['admin/content/node-type/' . $type_url_str . '/fivestar/' . urlencode($tag)] = array(
'title' => $tag,
'page callback' => 'drupal_get_form',
'page arguments' => array(
'fivestar_node_type_tag_form',
$type_name,
$tag,
),
'access arguments' => array(
'administer content types',
),
'type' => $tag == 'vote' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK,
'weight' => $tag == 'vote' ? 0 : 1,
'file' => 'includes/fivestar.admin.inc',
);
}
}
return $items;
}