Вопрос

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 :(

Это было полезно?

Решение

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

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top