本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeInterface::getDepth方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface::getDepth方法的具体用法?PHP NodeInterface::getDepth怎么用?PHP NodeInterface::getDepth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeInterface
的用法示例。
在下文中一共展示了NodeInterface::getDepth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerNodeChange
/**
* Register a node change for a later cache flush. This method is triggered by a signal sent via TYPO3CR's Node
* model or the Neos Publishing Service.
*
* @param NodeInterface $node The node which has changed in some way
* @return void
*/
public function registerNodeChange(NodeInterface $node)
{
$this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".';
$nodeTypesToFlush = $this->getAllImplementedNodeTypes($node->getNodeType());
foreach ($nodeTypesToFlush as $nodeType) {
$nodeTypeName = $nodeType->getName();
$this->tagsToFlush['NodeType_' . $nodeTypeName] = sprintf('which were tagged with "NodeType_%s" because node "%s" has changed and was of type "%s".', $nodeTypeName, $node->getPath(), $node->getNodeType()->getName());
}
$this->tagsToFlush['Node_' . $node->getIdentifier()] = sprintf('which were tagged with "Node_%s" because node "%s" has changed.', $node->getIdentifier(), $node->getPath());
$originalNode = $node;
while ($node->getDepth() > 1) {
$node = $node->getParent();
// Workaround for issue #56566 in TYPO3.TYPO3CR
if ($node === null) {
break;
}
$tagName = 'DescendantOf_' . $node->getIdentifier();
$this->tagsToFlush[$tagName] = sprintf('which were tagged with "%s" because node "%s" has changed.', $tagName, $originalNode->getPath());
}
}
示例2: generateCacheTags
/**
* Generates cache tags to be flushed for a node which is flushed on shutdown.
*
* Code duplicated from Neos' ContentCacheFlusher class
*
* @param NodeInterface|NodeData $node The node which has changed in some way
* @return void
*/
protected function generateCacheTags($node)
{
$this->tagsToFlush[ContentCache::TAG_EVERYTHING] = 'which were tagged with "Everything".';
$nodeTypesToFlush = $this->getAllImplementedNodeTypes($node->getNodeType());
foreach ($nodeTypesToFlush as $nodeType) {
/** @var NodeType $nodeType */
$nodeTypeName = $nodeType->getName();
$this->tagsToFlush['NodeType_' . $nodeTypeName] = sprintf('which were tagged with "NodeType_%s" because node "%s" has changed and was of type "%s".', $nodeTypeName, $node->getPath(), $node->getNodeType()->getName());
}
$this->tagsToFlush['Node_' . $node->getIdentifier()] = sprintf('which were tagged with "Node_%s" because node "%s" has changed.', $node->getIdentifier(), $node->getPath());
while ($node->getDepth() > 1) {
$node = $node->getParent();
if ($node === NULL) {
break;
}
$this->tagsToFlush['DescendantOf_' . $node->getIdentifier()] = sprintf('which were tagged with "DescendantOf_%s" because node "%s" has changed.', $node->getIdentifier(), $node->getPath());
}
if ($node instanceof NodeInterface && $node->getContext() instanceof ContentContext) {
$firstActiveDomain = $node->getContext()->getCurrentSite()->getFirstActiveDomain();
if ($firstActiveDomain) {
$this->domainsToFlush[] = $firstActiveDomain->getHostPattern();
}
}
}
示例3: getNodeLevelInSite
/**
* Node Level relative to site root node.
* 0 = Site root node
*
* @param NodeInterface $node
* @return integer
*/
protected function getNodeLevelInSite(NodeInterface $node)
{
$siteNode = $this->currentNode->getContext()->getCurrentSiteNode();
return $node->getDepth() - $siteNode->getDepth();
}
示例4: getACLPropertiesForNode
protected function getACLPropertiesForNode(NodeInterface $node)
{
$properties = ['nodeIdentifier' => $node->getIdentifier(), 'nodePath' => $node->getPath(), 'nodeLabel' => $node->getLabel(), 'nodeType' => $node->getNodeType()->getName(), 'nodeLevel' => $node->getDepth()];
return $properties;
}