From e2bcdd365a136eda0e77080d333e123fe8e67a1e Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 9 Dec 2019 08:21:55 +0100 Subject: [PATCH] RoleForm: Add zero-width char after each `/` in permission and restriction labels Helps browsers break onto newlines if it's too narrow. --- application/forms/Security/RoleForm.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/application/forms/Security/RoleForm.php b/application/forms/Security/RoleForm.php index 86cb8c815..a956fd0ce 100644 --- a/application/forms/Security/RoleForm.php +++ b/application/forms/Security/RoleForm.php @@ -209,7 +209,12 @@ class RoleForm extends RepositoryForm 'autosubmit' => isset($spec['isFullPerm']), 'disabled' => $hasFullPerm ?: null, 'value' => $hasFullPerm, - 'label' => isset($spec['label']) ? $spec['label'] : $spec['name'], + 'label' => preg_replace( + // Adds a zero-width char after each slash to help browsers break onto newlines + '~(? isset($spec['description']) ? $spec['description'] : $spec['name'] ] ) @@ -234,7 +239,12 @@ class RoleForm extends RepositoryForm 'text', $name, [ - 'label' => isset($spec['label']) ? $spec['label'] : $spec['name'], + 'label' => preg_replace( + // Adds a zero-width char after each slash to help browsers break onto newlines + '~(? $spec['description'] ] )