protected function ProtectionRuleFormBase::getBypassMessage in User protect 8
Construct message for bypass permission.
1 call to ProtectionRuleFormBase::getBypassMessage()
- ProtectionRuleFormBase::form in src/
Form/ ProtectionRuleFormBase.php - Gets the actual form array to be built.
File
- src/
Form/ ProtectionRuleFormBase.php, line 72
Class
- ProtectionRuleFormBase
- Provides a base form controller for a protection rule.
Namespace
Drupal\userprotect\FormCode
protected function getBypassMessage($permission, $permission_label) {
$message = $this
->t('Users with the permission "%permission".', [
'%permission' => $permission_label,
]);
$roles = user_role_names(FALSE, $permission);
if (count($roles)) {
$message .= '<br /><div class="description">' . $this
->t('Currently the following roles have this permission: %roles.', [
'%roles' => implode(', ', $roles),
]) . '</div>';
}
else {
$message .= '<br /><div class="description">' . $this
->t('Currently no roles have this permission.') . '</div>';
}
return [
'#markup' => $message,
];
}