user_user_role_insert we create actions per user role being created. We do this like this:
$action = entity_create('action', array( 'id' => $add_id, 'type' => 'user', 'label' => t('Add the @label role to the selected users', array('@label' => $role->label())), 'configuration' => array( 'rid' => $role->id(), ), 'plugin' => 'user_add_role_action', )); $action->trustData()->save();
At first sight the
t() looks wrong because it means config will be saved with the translated text - but actually I think this is fine since the configuration entity will have the language that the user has when they create the role. But what is more problematic is saving the escaped role label. This causes two problems - double escaping on
admin/people if the role label contains an
& and also potentially getting out of sync with the role label if that changes.
no idea yet
Find a solution.
User interface changes
Data model changes
Why is this an RC target?
- Escaping the role label during the creation of the action label leads to double escaping. This patch fixes 27 out of the 32 fails found by . Without this patch going in we can't implement some sort of generic double escaping test for all of our WebTestBase tests.
- Not keeping the action label in sync with the action label could result in a very confusing UI experience (image if role labels are swapped - yes that would be dumb but we all do dumb things sometimes)
- The fix creates a generic solution for actions to add arguments for it's labels. Given how actions are created based on other config entities this is likely to be needed again