From 9a47a09447bca9a7b7df330e28508b1c8ba6964f Mon Sep 17 00:00:00 2001 From: Nick Sagona Date: Thu, 24 Mar 2016 21:32:46 -0500 Subject: [PATCH] Patch required class for element label --- src/Form.php | 2 +- src/Template/File.php | 2 +- src/Template/Stream.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Form.php b/src/Form.php index 6a86423..ae56436 100644 --- a/src/Form.php +++ b/src/Form.php @@ -879,7 +879,7 @@ protected function renderWithoutTemplate() $label->setAttribute('for', ($name . $lblName)); $labelAttributes = $child->getLabelAttributes(); - if (null !== $labelAttributes) { + if (count($labelAttributes) > 0) { foreach ($labelAttributes as $a => $v) { if (($a == 'class') && ($child->isRequired())) { $v .= ' required'; diff --git a/src/Template/File.php b/src/Template/File.php index be9acdb..d30be6e 100644 --- a/src/Template/File.php +++ b/src/Template/File.php @@ -108,7 +108,7 @@ protected function renderTemplate() $label->setAttribute('for', $name); $labelAttributes = $child->getLabelAttributes(); - if (null !== $labelAttributes) { + if (count($labelAttributes) > 0) { foreach ($labelAttributes as $a => $v) { if (($a == 'class') && ($child->isRequired())) { $v .= ' required'; diff --git a/src/Template/Stream.php b/src/Template/Stream.php index 7789d0a..26cf3c7 100644 --- a/src/Template/Stream.php +++ b/src/Template/Stream.php @@ -103,7 +103,7 @@ protected function renderTemplate() $label->setAttribute('for', $name); $labelAttributes = $child->getLabelAttributes(); - if (null !== $labelAttributes) { + if (count($labelAttributes) > 0) { foreach ($labelAttributes as $a => $v) { if (($a == 'class') && ($child->isRequired())) { $v .= ' required';