php - Different form formatter for embeded form? -
i'm trying change form formatter of embeded form. possible approach this?
class sfouterform extends sfform { public function configure() { $innerform = new sfform(); $this->embedform('inner', $innerform); $this->getwidgetschema()->setformformatter('list'); $this->getembeddedform('inner')->getwidgetschema()->setformformattername('table'); } }
i'm expecting following:
echo (new sfouterform())
outputs:
<li><label>outer label</label><input type="text" /></li> <li> <table> <tr><td><label>inner label</label></td><td><input type="text" /></td></tr> </table> </li>
once form embedded, it's original widget schema , validator schema nothing - they've been merged top level schemas. thus, need set form formatter before embedding:
$this->getwidgetschema()->setformformatter('list'); $innerform = new sfform(); $innerform->getwidgetschema()->setformformattername('table'); $this->embedform('inner', $innerform);
it's worth sfform::embedform see what's going on internally.
Comments
Post a Comment