本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例8: getParents
protected function getParents(NodeInterface $contextNode, NodeInterface $siteNode)
{
$parents = array();
while ($contextNode !== $siteNode && $contextNode->getParent() !== null) {
$contextNode = $contextNode->getParent();
$parents[] = $contextNode;
}
return $parents;
}
示例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;
}
示例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));
}
示例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;
}
示例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