From 14a65a3503e2be30bc2d74ea467d05584dc5d643 Mon Sep 17 00:00:00 2001 From: Olivier PORTIER Date: Thu, 4 Mar 2021 15:20:00 +0100 Subject: [PATCH] Fix labels customization when $labels is passed to the twig function "login_form()" Check issue #15 --- src/Twig/LoginFormExtension.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Twig/LoginFormExtension.php b/src/Twig/LoginFormExtension.php index 3815d92..302dbba 100644 --- a/src/Twig/LoginFormExtension.php +++ b/src/Twig/LoginFormExtension.php @@ -64,7 +64,7 @@ public function getLoginForm(bool $withLabels = true, array $labels = []): strin public function getUsernameField(bool $withLabel, array $labels): string { - $text = in_array('username', $labels, true) ? $labels['username'] : 'Username'; + $text = array_key_exists('username', $labels) ? $labels['username'] : 'Username'; $label = $withLabel ? sprintf('', $text) : ''; $input = ''; @@ -74,7 +74,7 @@ public function getUsernameField(bool $withLabel, array $labels): string public function getPasswordField(bool $withLabel, array $labels): string { - $text = in_array('password', $labels, true) ? $labels['password'] : 'Password'; + $text = array_key_exists('password', $labels) ? $labels['password'] : 'Password'; $label = $withLabel ? sprintf('', $text) : ''; $input = ''; @@ -84,7 +84,7 @@ public function getPasswordField(bool $withLabel, array $labels): string public function getEmailField(bool $withLabel, array $labels): string { - $text = in_array('email', $labels, true) ? $labels['email'] : 'Email'; + $text = array_key_exists('email', $labels) ? $labels['email'] : 'Email'; $label = $withLabel ? sprintf('', $text) : ''; $input = ''; @@ -94,7 +94,7 @@ public function getEmailField(bool $withLabel, array $labels): string public function getSubmitButton(array $labels = []): string { - $text = in_array('submit', $labels, true) ? $labels['submit'] : 'Submit'; + $text = array_key_exists('submit', $labels) ? $labels['submit'] : 'Submit'; return sprintf('', $text); }