You are here

function node_limit_menu_alter in Node Limit 8

Same name and namespace in other branches
  1. 7 node_limit.module \node_limit_menu_alter()

Implements hook_menu_alter().

File

old/node_limit.module, line 100

Code

function node_limit_menu_alter(&$items) {
  node_type_cache_reset();
  foreach (node_type_get_types() as $type) {
    $type_url_str = str_replace('_', '-', $type->type);

    // Saving old access callbacks to allow other modules to define their own.
    variable_set('node_limit_' . $type->type . '_access_callback', $items['node/add/' . $type_url_str]['access callback']);
    variable_set('node_limit_' . $type->type . '_access_arguments', $items['node/add/' . $type_url_str]['access arguments']);
    $items['node/add/' . $type_url_str]['access callback'] = 'node_limit_access';
    $items['node/add/' . $type_url_str]['access arguments'] = array(
      $type->type,
    );
  }
  $items['node/add']['access callback'] = '_node_limit_add_access';
}