1

I have Views page with list of enities. The URL is /admin/group/12/members

There is a route in mymodule.routing.yml:

  mymodule_members_list:
  path: '/admin/group/{id}/members'
  requirements:
    _custom_access: '\Drupal\mymodule\Controller\GroupController::access'

The Group entity has field contains group administrator email (field_admin_email)

What I need is to allow administrator to only access a view with group/{id} associated with his email. (I have only problem with views access - it seems like views override my custom access method)

2

Solved!

Adding custom access to the Views is very easy: Just create own views access plugin by extending Drupal\views\Plugin\views\access\AccessPluginBase class.

Then implement custom access logic in access method and new rule should appear in PAGE SETTINGS > Access popup window.

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.