custom rendering: class ‘required’ in label is missing
Notice: This thread is very old.
- xlilien
- Member | 27
Hi, I have a problem using custom rendering forms. When the form is rendered by its default renderer, class required is added to all labels which are required. Nevertheless when using custom rendering, the class is missing.
This is an example how I render my form:
{form signInForm}
{label username /} {input username}
{/form}
This behavior can be seen even in the recent sandbox – if you disable default rendering and enable manual rendering.
Is there a way how to automatically show the required class in labels when rendering form manually?
- dr.ml
- Member | 1
Hi.
The required class can be added this way:
{form signInForm}
{label username class => $form['username']->required ? required /} {input username}
{/form}
Alternatively, you can define your own Latte macro, as is described here (czech only)