If like me you have been wondering how the Drupal 8/9 custom module yml files link together, it goes something like this:
xxxx.routing.yml
free_resources_dashboard: path: '/free-resources' defaults: _controller: '\Drupal\free_resources\Controller\FreeResources::dashboard' _title: 'My Resources' requirements: _permission: 'free resources dashboard'
xxxx.permissions.yml
free resources dashboard: title: 'Free Resources Dashboard' description: 'Allow access to the free resources dashboard page'
The free resources dashboard: line in the xxxx.permissions.yml file links to the _permissions: 'free resources dashboard' line in the xxxx.routing.yml file. If the _permissions: field does not match any of the defined permissions (for the site?) you will get a permissions error when you try and access your page.
No comments:
Post a Comment