We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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



8.1k

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.