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


PHP FlowQuery::parents方法代码示例

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


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

示例1: parentsFollowedByFirstMatchesInnermostNodeOnRootline

 /**
  * @test
  */
 public function parentsFollowedByFirstMatchesInnermostNodeOnRootline()
 {
     $teaserText = $this->node->getNode('teaser/dummy42');
     $q = new FlowQuery(array($teaserText));
     $actual = iterator_to_array($q->parents('[someSpecialProperty]')->first());
     $expected = array($this->node->getNode('teaser'));
     $this->assertTrue($expected === $actual);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:11,代码来源:ParentsOperationTest.php

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

示例3: breadcrumbNodesForNode

 /**
  * @param NodeInterface $node
  * @return array
  */
 protected function breadcrumbNodesForNode(NodeInterface $node)
 {
     $documentNodes = [];
     $flowQuery = new FlowQuery(array($node));
     $nodes = array_reverse($flowQuery->parents('[instanceof TYPO3.Neos:Document]')->get());
     /** @var NodeInterface $node */
     foreach ($nodes as $documentNode) {
         $documentNodes[] = $documentNode;
     }
     if ($node->getNodeType()->isOfType('TYPO3.Neos:Document')) {
         $documentNodes[] = $node;
     }
     return $documentNodes;
 }
开发者ID:johannessteu,项目名称:neos-aclinspector,代码行数:18,代码来源:ACLInspectorController.php

示例4: render

 /**
  * @param NodeInterface $node A node
  * @return array of document nodes
  */
 public function render(NodeInterface $node)
 {
     $documentNodes = [];
     $flowQuery = new FlowQuery(array($node));
     $nodes = array_reverse($flowQuery->parents('[instanceof TYPO3.Neos:Document]')->get());
     /** @var NodeInterface $node */
     foreach ($nodes as $documentNode) {
         $documentNodes[] = $documentNode;
     }
     if ($node->getNodeType()->isOfType('TYPO3.Neos:Document')) {
         $documentNodes[] = $node;
     }
     $this->templateVariableContainer->add('documentNodes', $documentNodes);
     $content = $this->renderChildren();
     $this->templateVariableContainer->remove('documentNodes');
     return $content;
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:21,代码来源:DocumentBreadcrumbPathViewHelper.php

示例5: evaluate

 /**
  * {@inheritdoc}
  *
  * @param FlowQuery $flowQuery the FlowQuery object
  * @param array $arguments the arguments for this operation
  * @return void
  */
 public function evaluate(FlowQuery $flowQuery, array $arguments)
 {
     if (!isset($arguments[0]) || empty($arguments[0])) {
         throw new \TYPO3\Eel\FlowQuery\FlowQueryException('closest() requires a filter argument', 1332492263);
     }
     $output = array();
     foreach ($flowQuery->getContext() as $contextNode) {
         $contextNodeQuery = new FlowQuery(array($contextNode));
         $contextNodeQuery->pushOperation('first', array());
         $contextNodeQuery->pushOperation('filter', $arguments);
         $parentsQuery = new FlowQuery(array($contextNode));
         $contextNodeQuery->pushOperation('add', array($parentsQuery->parents($arguments[0])->get()));
         foreach ($contextNodeQuery as $result) {
             $output[$result->getPath()] = $result;
         }
     }
     $flowQuery->setContext(array_values($output));
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:25,代码来源:ClosestOperation.php

示例6: evaluate

 /**
  * {@inheritdoc}
  *
  * @param FlowQuery $flowQuery
  * @param array $arguments
  * @return void
  */
 public function evaluate(FlowQuery $flowQuery, array $arguments)
 {
     $subject = $arguments[0];
     if (!isset($subject) || empty($subject)) {
         $flowQuery->setContext(array());
         return;
     }
     $filteredContext = array();
     $context = $flowQuery->getContext();
     if (is_string($subject)) {
         foreach ($context as $contextElement) {
             $contextElementQuery = new FlowQuery(array($contextElement));
             $contextElementQuery->pushOperation('children', $arguments);
             if ($contextElementQuery->count() > 0) {
                 $filteredContext[] = $contextElement;
             }
         }
     } else {
         if ($subject instanceof \TYPO3\Eel\FlowQuery\FlowQuery) {
             $elements = $subject->get();
         } elseif ($subject instanceof \Traversable) {
             $elements = iterator_to_array($subject);
         } elseif (is_object($subject)) {
             $elements = array($subject);
         } elseif (is_array($subject)) {
             $elements = $subject;
         } else {
             throw new \TYPO3\Eel\FlowQuery\FizzleException('supplied argument for has operation not supported', 1332489625);
         }
         foreach ($elements as $element) {
             if ($element instanceof NodeInterface) {
                 $parentsQuery = new FlowQuery(array($element));
                 /** @var NodeInterface $parent */
                 foreach ($parentsQuery->parents(array())->get() as $parent) {
                     /** @var NodeInterface $contextElement */
                     foreach ($context as $contextElement) {
                         if ($contextElement->getIdentifier() === $parent->getIdentifier()) {
                             $filteredContext[] = $contextElement;
                         }
                     }
                 }
             }
         }
         $filteredContext = array_unique($filteredContext);
     }
     $flowQuery->setContext($filteredContext);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:54,代码来源:HasOperation.php


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