In profile.api.php, hook_profile_access() is defined, but I don't think its being called. I'm guessing this should go in ProfileAccessControlHandler::checkAccess()?

Comments

kscheirer created an issue. See original summary.

nikathone’s picture

The call is being done inside \Drupal\Core\Entity\EntityAccessControlHandler::access(), so no need for profile module to duplicate this I think. On the other hand I would say that the documentation and arguments for the hook inside profile.api.php are wrong. I had to declare my hook like mymodule_profile_access(Drupal\profile\Entity\Profile $profile, $op, Drupal\Core\Session\AccountInterface $account) and return \Drupal\Core\Access\AccessResultInterface instead of bool for it to work. I don't know if I should create another issue for this or upload the patch here.

nedjo’s picture

Title: hook_profile_access() not called » Remove profile.api.php
Category: Bug report » Task

This hook is covered by core, see hook_ENTITY_TYPE_access(). Since this is the only function in profile.api.php, the file can be removed.

Alka Kumari’s picture

Assigned: Unassigned » Alka Kumari
Alka Kumari’s picture

Status: Active » Needs review
StatusFileSize
new1.75 KB

Removed profile.api.php from the module as it is not required.

kscheirer’s picture

Status: Needs review » Reviewed & tested by the community

looks good

Alka Kumari’s picture

Assigned: Alka Kumari » Unassigned

  • mglaman committed 64d0af9 on 8.x-1.x authored by Alka Kumari
    Issue #2823611 by Alka Kumari, kscheirer, nikathone, nedjo: Remove...
mglaman’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for cleanup, everyone!

Status: Fixed » Closed (fixed)

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