createNodeDataFromTemplate() public method

Creates and persists a node from the given $nodeTemplate as child node
public createNodeDataFromTemplate ( NodeTemplate $nodeTemplate, string $nodeName = null, Workspace $workspace = null, array $dimensions = null ) : NodeData
$nodeTemplate NodeTemplate
$nodeName string name of the new node. If not specified the name of the nodeTemplate will be used.
$workspace Workspace
$dimensions array
return NodeData the freshly generated node
Esempio n. 1
0
 /**
  * Creates and persists a node from the given $nodeTemplate as child node
  *
  * @param NodeTemplate $nodeTemplate
  * @param string $nodeName name of the new node. If not specified the name of the nodeTemplate will be used.
  * @return NodeInterface the freshly generated node
  * @api
  */
 public function createNodeFromTemplate(NodeTemplate $nodeTemplate, $nodeName = null)
 {
     $nodeData = $this->nodeData->createNodeDataFromTemplate($nodeTemplate, $nodeName, $this->context->getWorkspace(), $this->context->getDimensions());
     $node = $this->nodeFactory->createFromNodeData($nodeData, $this->context);
     $this->context->getFirstLevelNodeCache()->flush();
     $this->emitNodeAdded($node);
     return $node;
 }