Skip to content

Commit

Permalink
BaseFormElement::__construct(): Call setName() first
Browse files Browse the repository at this point in the history
The element name should be set first because the callback attribute
methods may need the name (for example: RadioElement::setOptions()).
  • Loading branch information
sukhwinder33445 committed Oct 27, 2022
1 parent 096c186 commit 307eaa9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/FormElement/BaseFormElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ abstract class BaseFormElement extends BaseHtmlElement implements FormElement, V
*/
public function __construct($name, $attributes = null)
{
$this->setName($name);

if ($attributes !== null) {
$this->addAttributes($attributes);
}
$this->setName($name);
}

public function getDescription()
Expand Down

0 comments on commit 307eaa9

Please sign in to comment.