From 87d7318de52755fbc85fe62f3af31386efac3adf Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Mon, 16 Aug 2021 21:43:27 +0100 Subject: [PATCH] [CONTROLLER][SECURITY] Added class names. Help labels for each form element. Each form element now has a proper block prefix (the resulting HTML won't simply concatenate the form's name to the element's label). --- public/assets/icons/check-on.svg | 5 +++++ src/Controller/Security.php | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 public/assets/icons/check-on.svg diff --git a/public/assets/icons/check-on.svg b/public/assets/icons/check-on.svg new file mode 100644 index 0000000000..672cfa9d47 --- /dev/null +++ b/public/assets/icons/check-on.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/Controller/Security.php b/src/Controller/Security.php index 67a86ec810..1e2232743e 100644 --- a/src/Controller/Security.php +++ b/src/Controller/Security.php @@ -72,6 +72,7 @@ class Security extends Controller $form = Form::create([ ['nickname', TextType::class, [ 'label' => _m('Nickname'), + 'help' => _m('Your desired nickname (e.g., j0hnD03)'), 'constraints' => [ new NotBlank(['message' => _m('Please enter a nickname')]), new Length([ @@ -80,14 +81,19 @@ class Security extends Controller 'max' => Nickname::MAX_LEN, 'maxMessage' => _m(['Your nickname must be at most # characters long'], ['count' => Nickname::MAX_LEN]), ]), ], + 'block_name' => 'nickname', + 'label_attr' => ['class' => 'section-form-label'], ]], ['email', EmailType::class, [ 'label' => _m('Email'), + 'help' => _m('Desired email for this account (e.g., john@provider.com)'), 'constraints' => [ new NotBlank(['message' => _m('Please enter an email') ])], + 'block_name' => 'email', + 'label_attr' => ['class' => 'section-form-label'], ]], FormFields::repeated_password(), ['register', SubmitType::class, ['label' => _m('Register')]], - ]); + ], builder_options: ['block_prefix' => 'register']); $form->handleRequest($request);