カスタムsfFormのラベルにいくつかのcss属性を追加しようとしましたが、それを実現できません。
カスタムクラスmyForm extends sfForm
では、すべてのテキストフィールドを動的に作成します。
public function configure()
{
$widgetFixtures = array();
foreach ($fixtures as $fixture) {
$widgetFixtures[$fixture->getId()] = new sfWidgetFormInputText(
array('label' => $fixture->getTeamNameDom()),
// I would like to add something like: array('class' => $fixture->getCSS()),
array('value' => $fixture->getScore1(), 'readonly' => 'readonly')
);
}
$this->setWidgets($widgetFixtures);
}
レンダリングをフォーマットしようとしましたsetFormFormatterName
が、成功しませんでした。
注:renderLabel($value, $attributes = array())
DBからCSSクラスを取得しているため、テンプレートで使用できません(ご覧のとおり、$ fixture-> getCSS()を使用する必要があります)。
誰かが私の光を当てることができますか?
どうもありがとう。