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


PHP NodeData::setDimensions方法代码示例

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


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

示例1: execute

 /**
  * Add dimensions to the node.
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeData $node
  * @return void
  */
 public function execute(\TYPO3\TYPO3CR\Domain\Model\NodeData $node)
 {
     $dimensionValuesToBeAdded = $node->getDimensionValues();
     foreach ($this->dimensionValues as $dimensionName => $dimensionValues) {
         if (!isset($dimensionValuesToBeAdded[$dimensionName])) {
             if (is_array($dimensionValues)) {
                 $dimensionValuesToBeAdded[$dimensionName] = $dimensionValues;
             } else {
                 $dimensionValuesToBeAdded[$dimensionName] = array($dimensionValues);
             }
         }
     }
     if ($this->addDefaultDimensionValues === TRUE) {
         $configuredDimensions = $this->contentDimensionRepository->findAll();
         foreach ($configuredDimensions as $configuredDimension) {
             if (!isset($dimensionValuesToBeAdded[$configuredDimension->getIdentifier()])) {
                 $dimensionValuesToBeAdded[$configuredDimension->getIdentifier()] = array($configuredDimension->getDefault());
             }
         }
     }
     $dimensionsToBeSet = array();
     foreach ($dimensionValuesToBeAdded as $dimensionName => $dimensionValues) {
         foreach ($dimensionValues as $dimensionValue) {
             $dimensionsToBeSet[] = new NodeDimension($node, $dimensionName, $dimensionValue);
         }
     }
     $node->setDimensions($dimensionsToBeSet);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:34,代码来源:AddDimensions.php

示例2: execute

 /**
  * Change the property on the given node.
  *
  * @param NodeData $node
  * @return void
  */
 public function execute(NodeData $node)
 {
     $dimensions = array();
     foreach ($this->dimensionValues as $dimensionName => $dimensionConfiguration) {
         foreach ($dimensionConfiguration as $dimensionValues) {
             if (is_array($dimensionValues)) {
                 foreach ($dimensionValues as $dimensionValue) {
                     $dimensions[] = new NodeDimension($node, $dimensionName, $dimensionValue);
                 }
             } else {
                 $dimensions[] = new NodeDimension($node, $dimensionName, $dimensionValues);
             }
         }
     }
     if ($this->addDefaultDimensionValues === true) {
         $configuredDimensions = $this->contentDimensionRepository->findAll();
         foreach ($configuredDimensions as $configuredDimension) {
             if (!isset($this->dimensionValues[$configuredDimension->getIdentifier()])) {
                 $dimensions[] = new NodeDimension($node, $configuredDimension->getIdentifier(), $configuredDimension->getDefault());
             }
         }
     }
     $node->setDimensions($dimensions);
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:30,代码来源:SetDimensions.php

示例3: execute

 /**
  * Change the property on the given node.
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeData $nodeData
  * @return void
  */
 public function execute(NodeData $nodeData)
 {
     $dimensions = $nodeData->getDimensions();
     if ($dimensions !== array()) {
         $hasChanges = false;
         $newDimensions = array();
         foreach ($dimensions as $dimension) {
             /** @var NodeDimension $dimension */
             if ($dimension->getName() === $this->oldDimensionName) {
                 $dimension = new NodeDimension($dimension->getNodeData(), $this->newDimensionName, $dimension->getValue());
                 $hasChanges = true;
             } else {
                 $dimension = new NodeDimension($dimension->getNodeData(), $dimension->getName(), $dimension->getValue());
             }
             $newDimensions[] = $dimension;
         }
         if ($hasChanges) {
             $nodeData->setDimensions($newDimensions);
         }
     }
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:27,代码来源:RenameDimension.php

示例4: setDimensionsRemovesDimensionValuesNotGiven

 /**
  * @test
  */
 public function setDimensionsRemovesDimensionValuesNotGiven()
 {
     $nodeData = new NodeData('/foo/bar', $this->mockWorkspace, null, array('c' => array('c1', 'c2'), 'a' => array('a1')));
     $dimensionsToSet = array(new NodeDimension($nodeData, 'c', 'c1'), new NodeDimension($nodeData, 'b', 'b1'), new NodeDimension($nodeData, 'f', 'f1'));
     $expectedDimensionValues = array('b' => array('b1'), 'c' => array('c1'), 'f' => array('f1'));
     $nodeData->setDimensions($dimensionsToSet);
     $setDimensionValues = $nodeData->getDimensionValues();
     $this->assertSame($expectedDimensionValues, $setDimensionValues);
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:12,代码来源:NodeDataTest.php


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