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


PHP Model\NodeInterface类代码示例

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


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

示例1: showAction

 /**
  * Shows the specified node and takes visibility and access restrictions into
  * account.
  *
  * @param NodeInterface $node
  * @return string View output for the specified node
  * @Flow\SkipCsrfProtection We need to skip CSRF protection here because this action could be called with unsafe requests from widgets or plugins that are rendered on the node - For those the CSRF token is validated on the sub-request, so it is safe to be skipped here
  * @Flow\IgnoreValidation("node")
  * @throws NodeNotFoundException
  */
 public function showAction(NodeInterface $node = NULL)
 {
     if ($node === NULL) {
         throw new NodeNotFoundException('The requested node does not exist or isn\'t accessible to the current user', 1430218623);
     }
     if (!$node->getContext()->isLive() && !$this->privilegeManager->isPrivilegeTargetGranted('TYPO3.Neos:Backend.GeneralAccess')) {
         $this->redirect('index', 'Login', NULL, array('unauthorized' => TRUE));
     }
     $inBackend = $node->getContext()->isInBackend();
     if ($node->getNodeType()->isOfType('TYPO3.Neos:Shortcut') && !$inBackend) {
         $this->handleShortcutNode($node);
     }
     $this->view->assign('value', $node);
     if ($inBackend) {
         $this->overrideViewVariablesFromInternalArguments();
         /** @var UserInterfaceMode $renderingMode */
         $renderingMode = $node->getContext()->getCurrentRenderingMode();
         $this->response->setHeader('Cache-Control', 'no-cache');
         if ($renderingMode !== NULL) {
             // Deprecated TypoScript context variable from version 2.0.
             $this->view->assign('editPreviewMode', $renderingMode->getTypoScriptPath());
         }
         if (!$this->view->canRenderWithNodeAndPath()) {
             $this->view->setTypoScriptPath('rawContent');
         }
     }
     if ($this->session->isStarted() && $inBackend) {
         $this->session->putData('lastVisitedNode', $node->getContextPath());
     }
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:40,代码来源:NodeController.php

示例2: handle

 /**
  * Set the node title for the newly created Document node
  *
  * @param NodeInterface $node The newly created node
  * @param array $data incoming data from the creationDialog
  * @return void
  */
 public function handle(NodeInterface $node, array $data)
 {
     if (isset($data['title']) && $node->getNodeType()->isOfType('TYPO3.Neos:Document')) {
         $node->setProperty('title', $data['title']);
         $node->setProperty('uriPathSegment', NodeUtility::renderValidNodeName($data['title']));
     }
 }
开发者ID:neos,项目名称:neos-ui,代码行数:14,代码来源:DocumentTitleNodeCreationHandler.php

示例3: resolveShortcutTarget

 /**
  * Resolves a shortcut node to the target. The return value can be
  *
  * * a NodeInterface instance if the target is a node or a node:// URI
  * * a string (in case the target is a plain text URI or an asset:// URI)
  * * NULL in case the shortcut cannot be resolved
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
  * @return NodeInterface|string|NULL
  */
 public function resolveShortcutTarget(NodeInterface $node)
 {
     $infiniteLoopPrevention = 0;
     while ($node->getNodeType()->isOfType('TYPO3.Neos:Shortcut') && $infiniteLoopPrevention < 50) {
         $infiniteLoopPrevention++;
         switch ($node->getProperty('targetMode')) {
             case 'selectedTarget':
                 $target = $node->getProperty('target');
                 if ($this->linkingService->hasSupportedScheme($target)) {
                     $targetObject = $this->linkingService->convertUriToObject($target, $node);
                     if ($targetObject instanceof NodeInterface) {
                         $node = $targetObject;
                     } elseif ($targetObject instanceof AssetInterface) {
                         return $this->linkingService->resolveAssetUri($target);
                     }
                 } else {
                     return $target;
                 }
                 break;
             case 'parentNode':
                 $node = $node->getParent();
                 break;
             case 'firstChildNode':
             default:
                 $childNodes = $node->getChildNodes('TYPO3.Neos:Document');
                 if ($childNodes !== array()) {
                     $node = reset($childNodes);
                 } else {
                     return null;
                 }
         }
     }
     return $node;
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:44,代码来源:NodeShortcutResolver.php

示例4: isActive

 public function isActive(NodeInterface $siteNode)
 {
     if ($siteModel = $this->siteRepository->findOneByNodeName($siteNode->getName())) {
         return $siteModel->isOnline();
     }
     throw new \RuntimeException('Could not find a site for the given site node', 1473366137);
 }
开发者ID:neos,项目名称:neos-ui,代码行数:7,代码来源:SitesHelper.php

示例5: createAction

 /**
  * Creates a new comment
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $postNode The post node which will contain the new comment
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeTemplate<RobertLemke.Plugin.Blog:Comment> $nodeTemplate
  * @return void
  */
 public function createAction(NodeInterface $postNode, NodeTemplate $newComment)
 {
     # Workaround until we can validate node templates properly:
     if (strlen($newComment->getProperty('author')) < 2) {
         $this->addFlashMessage('Your comment was NOT created - please specify your name.');
         $this->redirect('show', 'Frontend\\Node', 'TYPO3.Neos', array('node' => $postNode));
     }
     if (strlen($newComment->getProperty('text')) < 5) {
         $this->addFlashMessage('Your comment was NOT created - it was too short.');
         $this->redirect('show', 'Frontend\\Node', 'TYPO3.Neos', array('node' => $postNode));
     }
     if (filter_var($newComment->getProperty('emailAddress'), FILTER_VALIDATE_EMAIL) === FALSE) {
         $this->addFlashMessage('Your comment was NOT created - you must specify a valid email address.');
         $this->redirect('show', 'Frontend\\Node', 'TYPO3.Neos', array('node' => $postNode));
     }
     $commentNode = $postNode->getNode('comments')->createNodeFromTemplate($newComment, uniqid('comment-'));
     $commentNode->setProperty('spam', FALSE);
     $commentNode->setProperty('datePublished', new \DateTime());
     if ($this->akismetService->isCommentSpam('', $commentNode->getProperty('text'), 'comment', $commentNode->getProperty('author'), $commentNode->getProperty('emailAddress'))) {
         $commentNode->setProperty('spam', TRUE);
     }
     $this->addFlashMessage('Your new comment was created.');
     $this->emitCommentCreated($commentNode, $postNode);
     $this->redirect('show', 'Frontend\\Node', 'TYPO3.Neos', array('node' => $postNode));
 }
开发者ID:rotespferd,项目名称:Mariansievers.Plugin.News,代码行数:32,代码来源:CommentController.php

示例6: create

 /**
  * @param NodeInterface $parentNode
  * @param NodeType $nodeType
  * @return NodeInterface|void
  */
 public function create(NodeInterface $parentNode, NodeType $nodeType)
 {
     $title = Company::name();
     $name = Utility::renderValidNodeName($title);
     $childrenNode = $parentNode->createNode($name, $nodeType);
     $childrenNode->setProperty('title', $title);
     return $childrenNode;
 }
开发者ID:kdambekalns,项目名称:Flowpack.NodeGenerator,代码行数:13,代码来源:PageGeneratorImplementation.php

示例7: getClosestDocument

 /**
  * Helper method to retrieve the closest document for a node
  *
  * @param NodeInterface $node
  * @return NodeInterface
  */
 public function getClosestDocument(NodeInterface $node)
 {
     if ($node->getNodeType()->isOfType('TYPO3.Neos:Document')) {
         return $node;
     }
     $flowQuery = new FlowQuery(array($node));
     return $flowQuery->closest('[instanceof TYPO3.Neos:Document]')->get(0);
 }
开发者ID:skurfuerst,项目名称:PackageFactory.Guevara,代码行数:14,代码来源:NodeService.php

示例8: matches

 /**
  * Returns TRUE if the given node has the property and the value is not empty.
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
  * @return boolean
  */
 public function matches(\TYPO3\TYPO3CR\Domain\Model\NodeInterface $node)
 {
     if ($node->hasProperty($this->propertyName)) {
         $propertyValue = $node->getProperty($this->propertyName);
         return !empty($propertyValue);
     }
     return FALSE;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:14,代码来源:PropertyNotEmpty.php

示例9: 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

示例10: registerNodePathChange

 /**
  * Schedules flushing of the routing cache entry for the given $nodeData
  * Note: This is not done recursively because the nodePathChanged signal is triggered for any affected node data instance
  *
  * @param NodeInterface $node The affected node data instance
  * @return void
  */
 public function registerNodePathChange(NodeInterface $node)
 {
     if (in_array($node->getIdentifier(), $this->tagsToFlush)) {
         return;
     }
     if (!$node->getNodeType()->isOfType('TYPO3.Neos:Document')) {
         return;
     }
     $this->tagsToFlush[] = $node->getIdentifier();
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:17,代码来源:RouteCacheFlusher.php

示例11: 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

示例12: matches

 /**
  * Returns TRUE if the given node is of the node type this filter expects.
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
  * @return boolean
  */
 public function matches(\TYPO3\TYPO3CR\Domain\Model\NodeInterface $node)
 {
     if ($this->withSubTypes === TRUE) {
         return $this->nodeTypeManager->getNodeType($node->getNodeType())->isOfType($this->nodeTypeName);
     } else {
         $nodeData = \TYPO3\Flow\Reflection\ObjectAccess::getProperty($node, 'nodeData', TRUE);
         $nodeType = \TYPO3\Flow\Reflection\ObjectAccess::getProperty($nodeData, 'nodeType', TRUE);
         return $nodeType === $this->nodeTypeName;
     }
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:16,代码来源:NodeType.php

示例13: render

 /**
  * @param NodeInterface $node A document node
  * @return string
  */
 public function render(NodeInterface $node)
 {
     $output = '/' . $node->getLabel();
     $flowQuery = new FlowQuery(array($node));
     $nodes = $flowQuery->parents('[instanceof TYPO3.Neos:Document]')->get();
     /** @var NodeInterface $node */
     foreach ($nodes as $node) {
         $output = '/' . $node->getLabel() . $output;
     }
     return $output;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:15,代码来源:DocumentBreadcrumbPathViewHelper.php

示例14: filterNodeByContext

 /**
  * Filter a node by the current context.
  * Will either return the node or NULL if it is not permitted in current context.
  *
  * @param NodeInterface $node
  * @param Context $context
  * @return \TYPO3\TYPO3CR\Domain\Model\Node|NULL
  */
 protected function filterNodeByContext(NodeInterface $node, Context $context)
 {
     if (!$context->isRemovedContentShown() && $node->isRemoved()) {
         return NULL;
     }
     if (!$context->isInvisibleContentShown() && !$node->isVisible()) {
         return NULL;
     }
     if (!$context->isInaccessibleContentShown() && !$node->isAccessible()) {
         return NULL;
     }
     return $node;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:21,代码来源:NodeFactory.php

示例15: setUp

 public function setUp()
 {
     $this->siteNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface');
     $this->firstLevelNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface');
     $this->secondLevelNode = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface');
     $this->siteNode->expects($this->any())->method('getPath')->will($this->returnValue('/site'));
     $this->siteNode->expects($this->any())->method('getChildNodes')->will($this->returnValue(array($this->firstLevelNode)));
     $this->mockContext = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\Context')->disableOriginalConstructor()->getMock();
     $this->firstLevelNode->expects($this->any())->method('getParent')->will($this->returnValue($this->siteNode));
     $this->firstLevelNode->expects($this->any())->method('getPath')->will($this->returnValue('/site/first'));
     $this->secondLevelNode->expects($this->any())->method('getParent')->will($this->returnValue($this->siteNode));
     $this->secondLevelNode->expects($this->any())->method('getPath')->will($this->returnValue('/site/first/second'));
 }
开发者ID:sbruggmann,项目名称:neos-development-collection,代码行数:13,代码来源:ParentOperationTest.php


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