cf_menu.module in Common Functionality 7
File
modules/cf_menu/cf_menu.module
View source
<?php
function cf_menu_menu() {
$items = array();
$accessibility_page = variable_get('cf_menu_accessibility_page', TRUE);
if ($accessibility_page) {
$items['admin/content/accessibility'] = array(
'title' => "Accessibility",
'description' => "Content accessibility administrative pages.",
'page callback' => 'cf_menu_accessibility_page',
'type' => MENU_LOCAL_TASK,
'file' => 'menu.inc',
'file path' => drupal_get_path('module', 'cf_menu') . '/includes',
'access callback' => 'user_access',
'access arguments' => array(
'view content accessibility administration page',
),
);
}
return $items;
}
function cf_menu_cf_permission_alter(&$permissions) {
if (!is_array($permissions)) {
$permissions = array();
}
$accessibility_page = variable_get('cf_menu_accessibility_page', TRUE);
if ($accessibility_page) {
$permissions['view content accessibility administration page'] = array(
'title' => t("View Content Accessibility Administration Page"),
'description' => t("Grants permissions to view the content accessibility administration page."),
);
}
$permissions['view unpublished content in menu'] = array(
'title' => t("View Unpublished Content in Menu"),
'description' => t("Grants permissions to view menu items that is unpublished content. (This requires a patch against drupal core in order to function.)"),
);
}
function cf_menu_query_menu_tree_check_access_alter(&$query) {
if (user_access('view unpublished content in menu')) {
$where =& $query
->conditions();
foreach ($where as $key => &$value) {
if (is_string($value['field']) && $value['field'] == 'n.status') {
unset($where[$key]);
}
}
}
}