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


PHP NodeInterface::getParent方法代码示例

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


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

示例1: getNextForNode

 /**
  * @param NodeInterface $contextNode The node for which the preceding node should be found
  * @return NodeInterface The following node of $contextNode or NULL
  */
 protected function getNextForNode($contextNode)
 {
     $nodesInContext = $contextNode->getParent()->getChildNodes();
     for ($i = 1; $i < count($nodesInContext); $i++) {
         if ($nodesInContext[$i - 1] === $contextNode) {
             return $nodesInContext[$i];
         }
     }
     return null;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:14,代码来源:NextOperation.php

示例2: getPrevForNode

 /**
  * @param NodeInterface $contextNode The node for which the preceding node should be found
  * @return NodeInterface The preceding node of $contextNode or NULL
  */
 protected function getPrevForNode($contextNode)
 {
     $nodesInContext = $contextNode->getParent()->getChildNodes();
     for ($i = 0; $i < count($nodesInContext) - 1; $i++) {
         if ($nodesInContext[$i + 1] === $contextNode) {
             return $nodesInContext[$i];
         }
     }
     return NULL;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:14,代码来源:PrevOperation.php

示例3: getPrevForNode

 /**
  * @param NodeInterface $contextNode The node for which the preceding node should be found
  * @return NodeInterface The preceding nodes of $contextNode or NULL
  */
 protected function getPrevForNode(NodeInterface $contextNode)
 {
     $nodesInContext = $contextNode->getParent()->getChildNodes();
     $count = count($nodesInContext) - 1;
     for ($i = $count; $i > 0; $i--) {
         if ($nodesInContext[$i] === $contextNode) {
             unset($nodesInContext[$i]);
             return array_values($nodesInContext);
         } else {
             unset($nodesInContext[$i]);
         }
     }
     return null;
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:18,代码来源:PrevAllOperation.php

示例4: getNextForNode

 /**
  * @param NodeInterface $contextNode The node for which the preceding node should be found
  * @return NodeInterface The preceding nodes of $contextNode or NULL
  */
 protected function getNextForNode(NodeInterface $contextNode)
 {
     $nodesInContext = $contextNode->getParent()->getChildNodes();
     $count = count($nodesInContext);
     for ($i = 0; $i < $count; $i++) {
         if ($nodesInContext[$i] === $contextNode) {
             unset($nodesInContext[$i]);
             return array_values($nodesInContext);
         } else {
             unset($nodesInContext[$i]);
         }
     }
     return NULL;
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:18,代码来源:NextAllOperation.php

示例5: copyAfter

 /**
  * Copies this node after the given node
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $referenceNode
  * @param string $nodeName
  * @return \TYPO3\TYPO3CR\Domain\Model\NodeInterface
  * @throws NodeExistsException
  * @api
  */
 public function copyAfter(NodeInterface $referenceNode, $nodeName)
 {
     if ($referenceNode->getParent()->getNode($nodeName) !== NULL) {
         throw new NodeExistsException('Node with path "' . $referenceNode->getParent()->getPath() . '/' . $nodeName . '" already exists.', 1292503466);
     }
     if (!$this->isNodeDataMatchingContext()) {
         $this->materializeNodeData();
     }
     $copiedNode = $this->createRecursiveCopy($referenceNode, $nodeName);
     $copiedNode->moveAfter($referenceNode);
     $this->context->getFirstLevelNodeCache()->flush();
     $this->emitNodeAdded($copiedNode);
     return $copiedNode;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:23,代码来源:Node.php

示例6: getDesignatedParentNode

 /**
  * @param NodeInterface $targetNode
  * @param string $position
  * @return NodeInterface
  */
 protected function getDesignatedParentNode(NodeInterface $targetNode, $position)
 {
     $referenceNode = $targetNode;
     if (in_array($position, array('before', 'after'))) {
         $referenceNode = $targetNode->getParent();
     }
     return $referenceNode;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:13,代码来源:NodeOperations.php

示例7: copyAfter

 /**
  * Copies this node after the given node
  *
  * @param NodeInterface $referenceNode
  * @param string $nodeName
  * @return NodeInterface
  * @throws NodeExistsException
  * @throws NodeConstraintException
  * @api
  */
 public function copyAfter(NodeInterface $referenceNode, $nodeName)
 {
     if ($referenceNode->getParent()->getNode($nodeName) !== null) {
         throw new NodeExistsException('Node with path "' . $referenceNode->getParent()->getPath() . '/' . $nodeName . '" already exists.', 1292503466);
     }
     if (!$referenceNode->getParent()->isNodeTypeAllowedAsChildNode($this->getNodeType())) {
         throw new NodeConstraintException('Cannot copy ' . $this->__toString() . ' after ' . $referenceNode->__toString(), 1404648170);
     }
     $this->emitBeforeNodeCopy($this, $referenceNode->getParent());
     $copiedNode = $this->createRecursiveCopy($referenceNode->getParent(), $nodeName, $this->getNodeType()->isAggregate());
     $copiedNode->moveAfter($referenceNode);
     $this->context->getFirstLevelNodeCache()->flush();
     $this->emitNodeAdded($copiedNode);
     $this->emitAfterNodeCopy($copiedNode, $referenceNode->getParent());
     return $copiedNode;
 }
开发者ID:rderidder,项目名称:neos-development-collection,代码行数:26,代码来源:Node.php

示例8: getParents

 protected function getParents(NodeInterface $contextNode, NodeInterface $siteNode)
 {
     $parents = array();
     while ($contextNode !== $siteNode && $contextNode->getParent() !== null) {
         $contextNode = $contextNode->getParent();
         $parents[] = $contextNode;
     }
     return $parents;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:9,代码来源:ParentsUntilOperation.php

示例9: addGenericEditingMetadata

 /**
  * Collects metadata attributes used to allow editing of the node in the Neos backend.
  *
  * @param array $attributes
  * @param NodeInterface $node
  * @return array
  */
 protected function addGenericEditingMetadata(array $attributes, NodeInterface $node)
 {
     $attributes['typeof'] = 'typo3:' . $node->getNodeType()->getName();
     $attributes['about'] = $node->getContextPath();
     $attributes['data-node-_identifier'] = $node->getIdentifier();
     $attributes['data-node-__workspace-name'] = $node->getWorkspace()->getName();
     $attributes['data-node-__label'] = $node->getLabel();
     if ($node->getNodeType()->isOfType('TYPO3.Neos:ContentCollection')) {
         $attributes['rel'] = 'typo3:content-collection';
     }
     // these properties are needed together with the current NodeType to evaluate Node Type Constraints
     // TODO: this can probably be greatly cleaned up once we do not use CreateJS or VIE anymore.
     if ($node->getParent()) {
         $attributes['data-node-__parent-node-type'] = $node->getParent()->getNodeType()->getName();
     }
     if ($node->isAutoCreated()) {
         $attributes['data-node-_name'] = $node->getName();
         $attributes['data-node-_is-autocreated'] = 'true';
     }
     if ($node->getParent() && $node->getParent()->isAutoCreated()) {
         $attributes['data-node-_parent-is-autocreated'] = 'true';
         // we shall only add these properties if the parent is actually auto-created; as the Node-Type-Switcher in the UI relies on that.
         $attributes['data-node-__parent-node-name'] = $node->getParent()->getName();
         $attributes['data-node-__grandparent-node-type'] = $node->getParent()->getParent()->getNodeType()->getName();
     }
     return $attributes;
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:34,代码来源:ContentElementWrappingService.php

示例10: deleteAction

 /**
  * Deletes the specified node and all of its sub nodes
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
  * @return void
  * @ExtDirect
  */
 public function deleteAction(\TYPO3\TYPO3CR\Domain\Model\NodeInterface $node)
 {
     //		$node->remove();
     $nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(TRUE)->uriFor('show', array('node' => $node->getParent()), 'Frontend\\Node', 'TYPO3.TYPO3', '');
     $this->view->assign('value', array('data' => array('nextUri' => $nextUri), 'success' => TRUE));
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3,代码行数:13,代码来源:NodeController.php

示例11: createNodes

 /**
  * Create nodes. If any node has defined any sub-nodes again,
  * it calls configureCreateAssistanceChildNodes() recursively.
  *
  * @param NodeInterface $node
  * @param NodeType $nodeType
  * @param array $nodesToCreate
  * @param string $position : before, after, inside
  * @param array $args : arguments to be replaced in in property values (via vsprintf())
  * @return NodeInterface[]
  * @throws NodeConfigurationException
  * @throws \TYPO3\TYPO3CR\Exception\NodeConstraintException
  * @throws \TYPO3\TYPO3CR\Exception\NodeException
  * @throws \TYPO3\TYPO3CR\Exception\NodeExistsException
  * @throws \TYPO3\TYPO3CR\Exception\NodeTypeNotFoundException
  */
 protected function createNodes(NodeInterface $node, NodeType $nodeType, array $nodesToCreate, $position, array $args = [])
 {
     $createdNodes = [];
     foreach ($nodesToCreate as $config) {
         if (false === isset($config['nodeType'])) {
             throw new NodeConfigurationException("Missing `nodeType` to create for node `{$nodeType->getName()}`.", 1432821591);
         }
         // New node is just about to be created. Do we need to switch off auto-childNodes creation
         if (isset($config['enableAutoCreateNodes']) && false === $config['enableAutoCreateNodes']) {
             $this->enableAutoCreateNodes = false;
         }
         $newNodeType = $this->nodeTypeManager->getNodeType($config['nodeType']);
         if ('before' === $position) {
             $newNode = $node->getParent()->createNode(uniqid('node-'), $newNodeType);
             $newNode->moveBefore($node);
         } elseif ('after' === $position) {
             $newNode = $node->getParent()->createNode(uniqid('node-'), $newNodeType);
             $newNode->moveAfter($node);
         } else {
             $newNode = $node->createNode(uniqid('node-'), $newNodeType);
         }
         // Restore $enableAutoCreateNodes after node has been created
         $this->enableAutoCreateNodes = true;
         $createdNodes[$newNode->getIdentifier()] = $newNode;
         if (isset($config['properties'])) {
             $this->setNodeProperties($newNode, $config['properties'], $args);
         }
         // do we have another [beforeNodes, childNodes, afterNodes] to create? Go on...
         $this->configureCreateAssistanceChildNodes($newNode, $newNodeType, $config, $args);
     }
     return $createdNodes;
 }
开发者ID:simonschaufi,项目名称:M12.Foundation,代码行数:48,代码来源:NodeConfigurator.php

示例12: findFulltextRoot

 /**
  * @param NodeInterface $node
  * @return NodeInterface
  */
 protected function findFulltextRoot(NodeInterface $node)
 {
     if (in_array($node->getNodeType()->getName(), $this->fulltextRootNodeTypes)) {
         return NULL;
     }
     $currentNode = $node->getParent();
     while ($currentNode !== NULL) {
         if (in_array($currentNode->getNodeType()->getName(), $this->fulltextRootNodeTypes)) {
             return $currentNode;
         }
         $currentNode = $currentNode->getParent();
     }
     return NULL;
 }
开发者ID:kuborgh-mspindelhirn,项目名称:Flowpack.SimpleSearch.ContentRepositoryAdaptor,代码行数:18,代码来源:NodeIndexer.php


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