Menu Access Stack API
Categories
Component ID
2173949
Component name
Menu Access Stack API
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
Provides an API allowing the addition of new menu access functions on top of existing ones.
Example:
/**
* Implements hook_menu_alter().
*
* The natural place to inject additional menu-access checks to existing menu
* items is obviously hook_menu_alter.
*/
function menuaccessstack_example_menu_alter(&$items) {
// Add the access callback menuaccessstack_example_no_foo with the access
// arguments array(2) to the router item taxonomy/term/%taxonomy_term.
menuaccessstack_push($items['taxonomy/term/%taxonomy_term'], 'menuaccessstack_example_no_foo', array(2));
}
/**
* Never grant access to the term-page when the term name contains "foo".
*/
function menuaccessstack_example_no_foo($term) {
return (strpos($term->name, 'foo') === FALSE);
}