public function findTemplate(ContentNode $node) { //check if the node is already related to a template $template = $node->getTemplate(); // if no template is set try to guess one if (!$template) { $refClass = $this->getNativeClassnamimg($node); $className = $refClass['name']; $namespace = $refClass['namespace']; if (!empty($this->contentNodeTemplates[$className]) && count($this->contentNodeTemplates[$className]) > 0) { $template = reset($this->contentNodeTemplates[$className]); } else { $bundleName = $this->getBundleNameFromEntity($namespace, $this->get('kernel')->getBundles()); $template = $this->getDefaultTemplate($className, $bundleName); } } return $template; }
public function indexAction() { $nodeRow = new RowContentNode(); $nodeRow->setName("Parent Node"); $nodeRow->setAttributes(array('data-custom-data' => 'foobar')); /* $nodeR1 = new RowContentNode(); $nodeR1->setName("Parent Node"); $nodeRow->addNode($nodeR1);*/ $node1 = new ContentNode(); $node1->setName("Child Node 1"); $nodeRow->addNode($node1); $node2 = new ContentNode(); $node2->setName("Child Node 2"); $nodeRow->addNode($node2); $node3 = new ContentNode(); $node3->setName("Child Node 3"); $nodeRow->addNode($node3); return $this->render('MMCmfContentBundle:Default:index.html.twig', array('node' => $nodeRow)); }