Question

I'm searching the best way to output a label of a widget with a star (*) if this widget is required. It should be automatic.

I didn't find any way to do it :(

Was it helpful?

Solution

One way to do this is to use a custom form formatter.

OTHER TIPS

You could always look at setLabel in the form clas:

$this->widgetSchema->setLabel('YOUR_WIDGET', 'NAME <em>*</em>');

This will show the widget: NAME * which you can then style in CSS

With Symfony2 I'm going to use this simple CSS trick

.required:after {
    content: "*";
}

Found here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top