当前位置: 首页>>代码示例>>PHP>>正文


PHP NodeInterface::createSingleNode方法代码示例

本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeInterface::createSingleNode方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface::createSingleNode方法的具体用法?PHP NodeInterface::createSingleNode怎么用?PHP NodeInterface::createSingleNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\TYPO3CR\Domain\Model\NodeInterface的用法示例。


在下文中一共展示了NodeInterface::createSingleNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createRecursiveCopy

 /**
  * Create a recursive copy of this node below $referenceNode with $nodeName.
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $referenceNode
  * @param string $nodeName
  * @return \TYPO3\TYPO3CR\Domain\Model\NodeInterface
  */
 protected function createRecursiveCopy(NodeInterface $referenceNode, $nodeName)
 {
     $copiedNode = $referenceNode->createSingleNode($nodeName);
     $copiedNode->similarize($this);
     /** @var $childNode Node */
     foreach ($this->getChildNodes() as $childNode) {
         // Prevent recursive copy when copying into itself
         if ($childNode !== $copiedNode) {
             $childNode->copyInto($copiedNode, $childNode->getName());
         }
     }
     return $copiedNode;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:20,代码来源:Node.php

示例2: createRecursiveCopy

 /**
  * Create a recursive copy of this node below $referenceNode with $nodeName.
  *
  * $detachedCopy only has an influence if we are copying from one dimension to the other, possibly creating a new
  * node variant:
  *
  * - If $detachedCopy is TRUE, the whole (recursive) copy is done without connecting original and copied node,
  *   so NOT CREATING a new node variant.
  * - If $detachedCopy is FALSE, and the node does not yet have a variant in the target dimension, we are CREATING
  *   a new node variant.
  *
  * As a caller of this method, $detachedCopy should be TRUE if $this->getNodeType()->isAggregate() is TRUE, and FALSE
  * otherwise.
  *
  * @param NodeInterface $referenceNode
  * @param boolean $detachedCopy
  * @param string $nodeName
  * @return NodeInterface
  */
 protected function createRecursiveCopy(NodeInterface $referenceNode, $nodeName, $detachedCopy)
 {
     $identifier = null;
     $referenceNodeDimensions = $referenceNode->getDimensions();
     $referenceNodeDimensionsHash = Utility::sortDimensionValueArrayAndReturnDimensionsHash($referenceNodeDimensions);
     $thisDimensions = $this->getDimensions();
     $thisNodeDimensionsHash = Utility::sortDimensionValueArrayAndReturnDimensionsHash($thisDimensions);
     if ($detachedCopy === false && $referenceNodeDimensionsHash !== $thisNodeDimensionsHash && $referenceNode->getContext()->getNodeByIdentifier($this->getIdentifier()) === null) {
         // If the target dimensions are different than this one, and there is no node shadowing this one in the target dimension yet, we use the same
         // node identifier, effectively creating a new node variant.
         $identifier = $this->getIdentifier();
     }
     $copiedNode = $referenceNode->createSingleNode($nodeName, null, $identifier);
     $copiedNode->similarize($this, true);
     /** @var $childNode Node */
     foreach ($this->getChildNodes() as $childNode) {
         // Prevent recursive copy when copying into itself
         if ($childNode->getIdentifier() !== $copiedNode->getIdentifier()) {
             $childNode->copyIntoInternal($copiedNode, $childNode->getName(), $detachedCopy);
         }
     }
     return $copiedNode;
 }
开发者ID:rderidder,项目名称:neos-development-collection,代码行数:42,代码来源:Node.php

示例3: importNode

 /**
  * Converts the given $nodeXml to a node and adds it to the $parentNode (or overrides an existing node)
  *
  * @param \SimpleXMLElement $nodeXml
  * @param NodeInterface $parentNode
  * @return void
  */
 protected function importNode(\SimpleXMLElement $nodeXml, NodeInterface $parentNode)
 {
     $nodeName = (string) $nodeXml['nodeName'];
     $nodeType = $this->parseNodeType($nodeXml);
     $node = $parentNode->getNode($nodeName);
     if ($node === null) {
         $identifier = (string) $nodeXml['identifier'] === '' ? null : (string) $nodeXml['identifier'];
         $node = $parentNode->createSingleNode((string) $nodeXml['nodeName'], $nodeType, $identifier);
     } else {
         $node->setNodeType($nodeType);
     }
     $this->importNodeVisibility($nodeXml, $node);
     $this->importNodeProperties($nodeXml, $node);
     $this->importNodeAccessRoles($nodeXml, $node);
     if ($nodeXml->node) {
         foreach ($nodeXml->node as $childNodeXml) {
             $this->importNode($childNodeXml, $node);
         }
     }
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:27,代码来源:LegacySiteImportService.php

示例4: parseNodes

 /**
  * Iterates over the nodes and adds them to the workspace.
  *
  * @param \SimpleXMLElement $parentXml
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $parentNode
  * @return void
  */
 protected function parseNodes(\SimpleXMLElement $parentXml, \TYPO3\TYPO3CR\Domain\Model\NodeInterface $parentNode)
 {
     foreach ($parentXml->node as $childNodeXml) {
         $childNode = $parentNode->getNode((string) $childNodeXml['nodeName']);
         $contentTypeName = (string) $childNodeXml['type'];
         if (!$this->contentTypeManager->hasContentType($contentTypeName)) {
             $contentType = $this->contentTypeManager->createContentType($contentTypeName);
         } else {
             $contentType = $this->contentTypeManager->getContentType($contentTypeName);
         }
         if ($childNode === NULL) {
             $identifier = (string) $childNodeXml['identifier'] === '' ? NULL : (string) $childNodeXml['identifier'];
             $childNode = $parentNode->createSingleNode((string) $childNodeXml['nodeName'], $contentType, $identifier);
         } else {
             $childNode->setContentType($contentType);
         }
         $childNode->setHidden((bool) $childNodeXml['hidden']);
         $childNode->setHiddenInIndex((bool) $childNodeXml['hiddenInIndex']);
         if ($childNodeXml['hiddenBeforeDateTime'] != '') {
             $childNode->setHiddenBeforeDateTime(\DateTime::createFromFormat(\DateTime::W3C, (string) $childNodeXml['hiddenBeforeDateTime']));
         }
         if ($childNodeXml['hiddenAfterDateTime'] != '') {
             $childNode->setHiddenAfterDateTime(\DateTime::createFromFormat(\DateTime::W3C, (string) $childNodeXml['hiddenAfterDateTime']));
         }
         if ($childNodeXml->properties) {
             foreach ($childNodeXml->properties->children() as $childXml) {
                 if (isset($childXml['__type']) && (string) $childXml['__type'] == 'object') {
                     $childNode->setProperty($childXml->getName(), $this->xmlToObject($childXml));
                 } else {
                     $childNode->setProperty($childXml->getName(), (string) $childXml);
                 }
             }
         }
         if ($childNodeXml->accessRoles) {
             $accessRoles = array();
             foreach ($childNodeXml->accessRoles->children() as $childXml) {
                 $accessRoles[] = (string) $childXml;
             }
             $childNode->setAccessRoles($accessRoles);
         }
         if ($childNodeXml->node) {
             $this->parseNodes($childNodeXml, $childNode);
         }
     }
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3,代码行数:52,代码来源:SiteImportService.php


注:本文中的TYPO3\TYPO3CR\Domain\Model\NodeInterface::createSingleNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。