@@ -548,15 +548,7 @@ protected function getHtmlId($value, $attributes)
548548 */
549549 protected function getRequired ($ attributes )
550550 {
551- if (in_array ('required ' , $ attributes )) {
552- return true ;
553- }
554-
555- if (isset ($ attributes ['required ' ])) {
556- return $ attributes ['required ' ];
557- }
558-
559- return false ;
551+ return in_array ('required ' , $ attributes );
560552 }
561553
562554 /**
@@ -666,20 +658,15 @@ protected function getControlErrors($name)
666658 * @param array $attributes
667659 * @param array $errors
668660 * @param string $htmlId
669- * @param bool $required
670661 * @return array
671662 */
672- protected function getHtmlAttributes ($ type , $ attributes , $ errors , $ htmlId, $ required )
663+ protected function getHtmlAttributes ($ type , $ attributes , $ errors , $ htmlId )
673664 {
674665 $ attributes ['class ' ] = $ this ->getClasses ($ type , $ attributes , $ errors );
675666
676667 $ attributes ['id ' ] = $ htmlId ;
677668
678- if ($ required && !in_array ('required ' , $ attributes )) {
679- $ attributes [] = 'required ' ;
680- }
681-
682- unset($ attributes ['template ' ], $ attributes ['required ' ], $ attributes ['label ' ]);
669+ unset($ attributes ['template ' ], $ attributes ['label ' ]);
683670
684671 return $ attributes ;
685672 }
@@ -755,7 +742,7 @@ protected function doBuild($type, $name, $value = null, array $attributes = arra
755742 $ hasErrors = !empty ($ errors );
756743 $ customTemplate = $ this ->getCustomTemplate ($ attributes );
757744
758- $ attributes = $ this ->getHtmlAttributes ($ type , $ attributes , $ errors , $ id, $ required );
745+ $ attributes = $ this ->getHtmlAttributes ($ type , $ attributes , $ errors , $ id );
759746
760747 $ input = $ this ->buildControl ($ type , $ name , $ value , $ attributes , $ options , $ htmlName , $ hasErrors );
761748
0 commit comments