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 26, 2022
1 parent b04b6ba commit 6376262
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 6376262

Please sign in to comment.