tranformation html (element label in formhelp)

Hi all $username->setLabel('Username');//<label for="username">Username</label> I wan to <label class="control-label" for= "username">Username</label> how to, thank all



7.3k

You can use 2 ways: 1) Create a custom class and rewrite function label in it. Because just function label return html string php <label>...</label>.

2) Use another construction, like :

echo '<label for="', $element->getName(), '">', $element->getLabel(), '</label>';

or

printf('<label for="%s" class="%s">%s</label>',$element->getName(),$your_class_for_label,$element->getLabel());

in render form function or in a view.