Looking through the Drupal coding conventions http://drupal.org/coding-standards#naming I have seen module, variable, function, and many other areas but not for permission names. Are there any conventions to the Drupal 7 permissions hook to keep from creating permission names that might interfere with others?


AFAIK there's no official recommendations.

Given that all permissions share the same namespace it's a good idea to avoid generic names. You can include the name of the module that defines the permissions to minimize collision risk.

| improve this answer | |
  • Is this still the case for Drupal 8? – anoopjohn Nov 17 '19 at 23:36
  • Drupal 8 changes how you declare permissions. Now they are declared in a yml file, with am id, title and desc. I suspect there's no collision problem because there are declared in different yml files, but I can't confirm this. – sanzante Nov 18 '19 at 13:07
  • 1
    Looks like this is still the case. Even though we are putting them in yml files you still check for the permission string without any namespace. So there is still the chance for conflict. – anoopjohn Nov 19 '19 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.