O'Reilly logo

Drupal 7 Module Development by Ken Rickard, John Wilkins, Larry Garfield, Matt Butcher, Greg Dunlap, Matt Farina

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using hook_permission()

Now that you understand the basics of Drupal's user access system, we can explore how modules can extend that system. First, a little history lesson.

Until Drupal 7, hook_permission() was known as hook_perm(). The change was made for clarity in the code, as part of a general semantic cleanup of Drupal core. (I wrote the patch, in fact.) hook_permission() also includes a number of usability improvements, which altered the format of the function's return value. These changes are substantial enough for even experienced Drupal developers to explore each element of the new hook.

The purpose of hook_permission() is to define and return an array that contains all the necessary information about your module's permissions. This includes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required