Exemple #1
0
 /**
  * Create child nodes
  *
  * @return NodeInterface
  */
 public function createChildNodes(NodeInterface $node)
 {
     /** @var NodeInterface $nodeType */
     foreach ($this->getNodeTypes($this->getNodeGroup()) as $nodeType) {
         foreach ($nodeType->getMatches($node->getCurrentContent()) as $offset => $match) {
             $this->createChildNode($node, $nodeType, $match, $offset);
         }
     }
     return $this;
 }
Exemple #2
0
 /**
  * Inject content
  */
 public function injectContent(NodeInterface $child, NodeInterface $parent)
 {
     if ($child instanceof BlockInterface or !$child->isPhp()) {
         $source = $child->compile();
     } else {
         $source = $this->php($child->compile());
     }
     if (!($validate = $child->validate())) {
         $this->getLexicon()->getFoundation()->getNodeFactory()->getCollection()->forget($child->getId());
     }
     $content = preg_replace($this->search($child->getExtractionId()), $source, $parent->getCurrentContent(), self::LIMIT);
     $parent->setCurrentContent($content);
 }