Documenting hooks in a .api.php file is best practice for all Drupal modules.

The two hooks provided by Content Access are:

  1. hook_user_acl($settings)
  2. hook_per_node($settings, $node)

As noted in #2581121-4: $node not passed as argument in "per_node" hook, these really should be renamed. I have opened up a new issue for that. See #3226834: Rename hooks to include 'content_access' prefix. But the first step is to completely document the hooks we have and how we intend them to work.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

TR created an issue. See original summary.

gisle’s picture

Official guidelines.

gisle’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

All feature requests go into the most recent branch.

gisle’s picture

Status: Active » Patch (to be ported)
Related issues: +#1145984: API Documentaion

There is already a patch for this for the Drupal 7 version: #1145984: API Documentaion.

uttam made their first commit to this issue’s fork.

uttam’s picture

Please check if it's right or not.

steven jones’s picture

Hi @uttam thanks for the contribution, and thanks for trying, however in the interests of being completely honest: that code isn't what's needed here.

What we need to do is take the change that was added in #1145984: API Documentaion and add that to our 2.0.x branch, making any adjustments required for changes in the Drupal 8 hook signatures.

uttam’s picture

Thanks for the review

liam morland made their first commit to this issue’s fork.

liam morland’s picture

Category: Feature request » Task
Status: Patch (to be ported) » Needs review

I cherry-picked the change from #1145984: API Documentaion and then updated it as best I could for 2.x.

steven jones’s picture

Version: 2.0.x-dev » 2.1.x-dev

Did a bit of work on this one, documenting the two hooks correctly.

steven jones’s picture

Status: Needs review » Fixed

Merged that in. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • steven jones committed 95f6bcae on 2.1.x
    fix: #3226837 Document this module's hooks in content_access.api.php
    
    By...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.