Problem/Motivation
#2475263: Remove Role::postSave() method had to remove helpful error messages, because it switched from always access and then show error message to proper access callbacks.
It is currently not possible to show any kind of helpful error message.
However drupal_set_message() in the menu router access callback did not work as we did not know when it was called. (on link generation time or on request / route time).
Daniel pointed out a way how it is possible with the new routing infrastructure.
Proposed resolution
- Use function access(Request $request = NULL)
- Bring back the error messages via drupal_set_message if $request != NULL
Remaining tasks
- Use function access(Request $request = NULL)
- Bring back the error messages via drupal_set_message if $request != NULL
User interface changes
- None
API changes
- None
--
This is a bug, because the UX was better in D7, but its not enough of a bug to block #2475263: Remove Role::postSave() method.
Comments
Comment #1
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedComment #2
dawehnerAs written in IRC you can pretty much achieve that already in case you specify
$request = NULL
in your access method.Comment #3
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedComment #4
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedComment #15
catchThis is already an error condition and will generally only happen if someone has a tab open while the comment settings are changed. Moving to a task.
Access objects can have reasons, so I wonder if the actual fix here might be to start looking at surfacing those reasons in access denied message, although that would be a much bigger change.