I define a custom entity named "Politician", where I set the class PoliticianAccessControl as an access handler. This is working fine for the canonical url of the entity set in the following way:
entity.politician.canonical:
path: '/politician/{politician}'
defaults:
_controller: '\Drupal\pw_basic\Controller\EntityViewController\PoliticianViewController::view'
_title_callback: '\Drupal\pw_basic\Controller\EntityViewController\PoliticianViewController::title'
requirements:
_entity_access: 'politician.view'
See the entity access requirement? Here the method PoliticianAccessControl->checkAccess() ist called, everything works just fine.
But when I try the same with another custom route the PoliticianAccessControl class gets not called and I always get an access denied message:
entity.politician.about_me:
path: '/politician/{politician}/about-me'
defaults:
_controller: '\Drupal\pw_basic\Controller\PoliticianFrontend\AboutMe::build'
_title_callback: '\Drupal\pw_basic\Controller\PoliticianFrontend\AboutMe::title'
requirements:
_entity_access: 'politician.view'
What do I forget?