diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 1d503f6..aa363fa 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -65,10 +65,11 @@ function shortcut_set_edit_access(ShortcutSetInterface $shortcut_set = NULL) { // Sufficiently-privileged users can edit their currently displayed shortcut // set, but not other sets. They must also be able to access shortcuts. $may_edit_current_shortcut_set = $account->hasPermission('customize shortcut links') && (!isset($shortcut_set) || $shortcut_set == shortcut_current_displayed_set()) && $account->hasPermission('access shortcuts'); - if (!$may_edit_current_shortcut_set) { - return AccessResult::neutral("The 'access shortcuts' AND 'customize shortcut links' permissions is required.")->cachePerPermissions(); + $result = AccessResult::allowedIf($may_edit_current_shortcut_set)->cachePerPermissions(); + if (!$result->isAllowed()) { + $result->setReason("The 'access shortcuts' AND 'customize shortcut links' permissions is required."); } - return AccessResult::allowed()->cachePerPermissions(); + return $result; } /**