// Switch to a different shortcut set.
/** @var \Drupal\shortcut\Entity\ShortcutSet $set */
$set =
$this->shortcutSetStorage->
load($form_state->
getValue('set'
));
$replacements =
[ '%user' =>
$this->user->
getDisplayName(),
'%set_name' =>
$set->
label(),
];
$this->
messenger()->
addStatus($account_is_user ?
$this->
t('You are now using the %set_name shortcut set.',
$replacements) :
$this->
t('%user is now using the %set_name shortcut set.',
$replacements));
} // Assign the shortcut set to the provided user account.
$this->shortcutSetStorage->
assignUser($set,
$this->user
);
} /**
* Checks access for the shortcut set switch form.
*
* @param \Drupal\user\UserInterface $user
* (optional) The owner of the shortcut set.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/