You are here

chain_menu_access_test.module in Chain Menu Access API 8

Dummy module implementing menu access functions to test the Chain Menu Access API module.

File

tests/chain_menu_access_test.module
View source
<?php

/**
 * @file
 * Dummy module implementing menu access functions to test the
 * Chain Menu Access API module.
 */

/**
 * Implements hook_menu_alter().
 */
function chain_menu_access_test_menu_alter(&$menu) {

  // Allow everyone access to admin/people/create (#1079032).
  chain_menu_access_chain($menu, 'admin/people/create', 'chain_menu_access_test_enabled', array(
    'admin/people/create',
  ), TRUE);
}

/**
 * Dynamically turn this module on and off.
 */
function chain_menu_access_test_enabled($path) {
  $query = drupal_get_query_parameters();
  $enabled = !empty($query['enable_cma']);
  drupal_set_message("Access to {$path} is " . ($enabled ? 'ENABLED' : 'DISABLED') . '.');
  return $enabled;
}

Functions

Namesort descending Description
chain_menu_access_test_enabled Dynamically turn this module on and off.
chain_menu_access_test_menu_alter Implements hook_menu_alter().