Пример #1
0
 public function _for(HtmlNode $node, TemplateNode $value)
 {
     $internal = new InternalNode();
     foreach ($node->getChildren() as $child) {
         $internal->append($child->detach());
     }
     $start = '$Form->formFor(' . PhpNode::expr($value)->code . ', ';
     if ($node->hasAttribute('action')) {
         $start .= PhpNode::expr($node->getAttribute('action'))->code . ', ';
         $node->removeAttribute('action');
     } else {
         $start .= 'array(), ';
     }
     $start .= PhpNode::attributes($node)->code . ')';
     $internal->prepend(new PhpNode($start, true));
     $internal->append(new PhpNode('$Form->end()'));
     $node->replaceWith($internal);
 }