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


PHP Context::getTargetDimensions方法代码示例

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


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

示例1: dimensionsAreMatchingTargetDimensionValues

 /**
  * Internal method
  *
  * The dimension value of this node has to match the current target dimension value (must be higher in priority or equal)
  *
  * @return boolean
  */
 public function dimensionsAreMatchingTargetDimensionValues()
 {
     $dimensions = $this->getDimensions();
     $contextDimensions = $this->context->getDimensions();
     foreach ($this->context->getTargetDimensions() as $dimensionName => $targetDimensionValue) {
         if (!isset($dimensions[$dimensionName])) {
             if ($targetDimensionValue === null) {
                 continue;
             } else {
                 return false;
             }
         } elseif ($targetDimensionValue === null && $dimensions[$dimensionName] === array()) {
             continue;
         } elseif (!in_array($targetDimensionValue, $dimensions[$dimensionName], true)) {
             $contextDimensionValues = $contextDimensions[$dimensionName];
             $targetPositionInContext = array_search($targetDimensionValue, $contextDimensionValues, true);
             $nodePositionInContext = min(array_map(function ($value) use($contextDimensionValues) {
                 return array_search($value, $contextDimensionValues, true);
             }, $dimensions[$dimensionName]));
             $val = $targetPositionInContext !== false && $nodePositionInContext !== false && $targetPositionInContext >= $nodePositionInContext;
             if ($val === false) {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:34,代码来源:Node.php

示例2: dimensionsAreMatchingTargetDimensionValues

 /**
  * The dimension value of this node has to match the current target dimension value (must be higher in priority or equal)
  *
  * @return boolean
  */
 protected function dimensionsAreMatchingTargetDimensionValues()
 {
     $dimensions = $this->getDimensions();
     $contextDimensions = $this->context->getDimensions();
     foreach ($this->context->getTargetDimensions() as $dimensionName => $targetDimensionValue) {
         if (!isset($dimensions[$dimensionName])) {
             return FALSE;
         } elseif (!in_array($targetDimensionValue, $dimensions[$dimensionName], TRUE)) {
             $contextDimensionValues = $contextDimensions[$dimensionName];
             $targetPositionInContext = array_search($targetDimensionValue, $contextDimensionValues, TRUE);
             $nodePositionInContext = min(array_map(function ($value) use($contextDimensionValues) {
                 return array_search($value, $contextDimensionValues, TRUE);
             }, $dimensions[$dimensionName]));
             $val = $targetPositionInContext !== FALSE && $nodePositionInContext !== FALSE && $targetPositionInContext >= $nodePositionInContext;
             if ($val === FALSE) {
                 return FALSE;
             }
         }
     }
     return TRUE;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:26,代码来源:Node.php

示例3: beforeAdoptNode

 /**
  *
  *
  * @param NodeInterface $node
  * @param Context $context
  * @param $recursive
  * @return void
  */
 public function beforeAdoptNode(NodeInterface $node, Context $context, $recursive)
 {
     if (!$this->eventEmittingService->isEnabled()) {
         return;
     }
     $this->initializeAccountIdentifier();
     if ($this->currentlyAdopting === 0) {
         /* @var $nodeEvent NodeEvent */
         $nodeEvent = $this->eventEmittingService->emit(self::NODE_ADOPT, array('targetWorkspace' => $context->getWorkspaceName(), 'targetDimensions' => $context->getTargetDimensions(), 'recursive' => $recursive), 'TYPO3\\Neos\\EventLog\\Domain\\Model\\NodeEvent');
         $nodeEvent->setNode($node);
         $this->eventEmittingService->pushContext();
     }
     $this->currentlyAdopting++;
 }
开发者ID:testbird,项目名称:neos-development-collection,代码行数:22,代码来源:TYPO3CRIntegrationService.php

示例4: adjustToContext

 /**
  * Adjust this instance to the given context.
  *
  * Internal use only!
  *
  * @param Context $context
  * @throws \TYPO3\TYPO3CR\Exception\InvalidNodeContextException
  */
 public function adjustToContext(Context $context)
 {
     $this->setWorkspace($context->getWorkspace());
     $nodeDimensions = new \Doctrine\Common\Collections\ArrayCollection();
     $targetDimensionValues = $context->getTargetDimensions();
     foreach ($context->getDimensions() as $dimensionName => $dimensionValues) {
         if (!isset($targetDimensionValues[$dimensionName])) {
             throw new \TYPO3\TYPO3CR\Exception\InvalidNodeContextException(sprintf('Missing target value for dimension "%"', $dimensionName), 1391686089);
         }
         $dimensionValueToSet = $targetDimensionValues[$dimensionName];
         $nodeDimensions->add(new NodeDimension($this, $dimensionName, $dimensionValueToSet));
     }
     $this->setDimensions($nodeDimensions);
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:22,代码来源:NodeData.php


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