class FormDecorators {
public static $simpleElementDecorators = array(
array('ViewHelper'),
array('Label', array('tag' => 'span', 'escape' => false, 'requiredPrefix' => '<span class="required">* </span>')),
array('Description', array('tag' => 'div', 'class' => 'desc-item')),
array('Errors', array('class' => 'errors')),
array('HtmlTag', array('tag' => 'div', 'class' => 'form-item'))
);
}
对于你使用的元素
$elem->setDecorators(FormDecorators::$simpleElementDecorators)
我在标签数组中添加了带有“requiredPrefix”参数的必需前缀。
array('Label', array('tag' => 'span', 'escape' => false, 'requiredPrefix' => '<span class="required">* </span>')),