This is a simple module to make developer's life easier, it adds the "access argument" parameter to each permission row in admin permissions page ( admin/people/permissions ).
So, developer can copy and use it in custom modules hooks and functions e.g. hook_menu() and user_access() in D7, or routing.yml in D8 ( as: _permission ).
Example to use it in hook_menu() for D7:
# Drupal 7 menu item
$items['admin/content/book'] = array(
'title' => 'Books',
'description' => "Manage your site's book outlines.",
'page callback' => 'book_admin_overview',
'access arguments' => array('administer book outlines'),
'type' => MENU_LOCAL_TASK,
'file' => 'book.admin.inc',
);
Example to use it in routing.yml for D8:
# Drupal 8 book.routing.yml snippet
book.admin:
path: '/admin/content/book'
defaults:
_controller: '\Drupal\book\Controller\BookController::adminOverview'
_title: 'Books'
requirements:
_permission: 'administer book outlines'
Here is more information about Convert hook_menu() to Drupal 8 APIs, included access argument usage.
Project information
- Module categories: Administration Tools, Access Control, Developer Tools
- 27 sites report using this module
- Created by bilal.alhallak on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Support Drupal 9 & 10.
Development version: 2.0.x-dev updated 21 Mar 2023 at 18:11 UTC
Development version: 7.x-1.x-dev updated 29 Dec 2017 at 06:33 UTC