本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Model\NodeData::getDimensionValues方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeData::getDimensionValues方法的具体用法?PHP NodeData::getDimensionValues怎么用?PHP NodeData::getDimensionValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\TYPO3CR\Domain\Model\NodeData
的用法示例。
在下文中一共展示了NodeData::getDimensionValues方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Add dimensions to the node.
*
* @param NodeData $node
* @return void
*/
public function execute(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);
}
示例2: matches
/**
* Returns TRUE if the given node has the default dimension values.
*
* @param \TYPO3\TYPO3CR\Domain\Model\NodeData $node
* @return boolean
*/
public function matches(\TYPO3\TYPO3CR\Domain\Model\NodeData $node)
{
if ($this->filterForDefaultDimensionValues === true) {
$configuredDimensions = $this->contentDimensionRepository->findAll();
foreach ($configuredDimensions as $dimension) {
$this->dimensionValues[$dimension->getIdentifier()] = array($dimension->getDefault());
}
}
return $node->getDimensionValues() === $this->dimensionValues;
}
示例3: createContextMatchingNodeData
/**
* Generates a Context that exactly fits the given NodeData Workspace, Dimensions & Site.
*
* @param NodeData $nodeData
* @return ContentContext
*/
protected function createContextMatchingNodeData(NodeData $nodeData)
{
$nodePath = NodePaths::getRelativePathBetween(SiteService::SITES_ROOT_PATH, $nodeData->getPath());
list($siteNodeName) = explode('/', $nodePath);
$site = $this->siteRepository->findOneByNodeName($siteNodeName);
$contextProperties = ['workspaceName' => $nodeData->getWorkspace()->getName(), 'invisibleContentShown' => true, 'inaccessibleContentShown' => true, 'removedContentShown' => true, 'dimensions' => $nodeData->getDimensionValues(), 'currentSite' => $site];
if ($domain = $site->getFirstActiveDomain()) {
$contextProperties['currentDomain'] = $domain;
}
return $this->_contextFactory->create($contextProperties);
}
示例4: getDimensions
/**
* Return the assigned content dimensions of the node.
*
* @return array
*/
public function getDimensions()
{
return $this->nodeData->getDimensionValues();
}
示例5: createNodeForVariant
/**
* Create a node for the given NodeData, given that it is a variant of the current node
*
* @param NodeData $nodeData
* @return Node
*/
protected function createNodeForVariant($nodeData)
{
$contextProperties = $this->context->getProperties();
$contextProperties['dimensions'] = $nodeData->getDimensionValues();
unset($contextProperties['targetDimensions']);
$adjustedContext = $this->contextFactory->create($contextProperties);
return $this->nodeFactory->createFromNodeData($nodeData, $adjustedContext);
}
示例6: adjustShadowNodeData
/**
* Adjust the given $shadowNodeData by removing it or moving it to the $targetWorkspace, as needed.
*
* @param NodeData $shadowNodeData
* @param NodeData $publishedNodeData
* @param Workspace $targetWorkspace
* @param NodeData $targetNodeData
* @return void
*/
protected function adjustShadowNodeData(NodeData $shadowNodeData, NodeData $publishedNodeData, Workspace $targetWorkspace, NodeData $targetNodeData)
{
$nodeOnSamePathInTargetWorkspace = $this->nodeDataRepository->findOneByPath($shadowNodeData->getPath(), $targetWorkspace, $publishedNodeData->getDimensionValues());
if ($nodeOnSamePathInTargetWorkspace !== null && $nodeOnSamePathInTargetWorkspace->getWorkspace() === $targetWorkspace) {
$this->nodeDataRepository->remove($shadowNodeData);
return;
}
$shadowNodeData->setMovedTo($targetNodeData);
$shadowNodeData->setWorkspace($targetWorkspace);
$targetWorkspaceBase = $targetWorkspace->getBaseWorkspace();
$nodeInTargetWorkspaceBase = $this->nodeDataRepository->findOneByIdentifier($publishedNodeData->getIdentifier(), $targetWorkspaceBase, $publishedNodeData->getDimensionValues());
if ($nodeInTargetWorkspaceBase !== null && $nodeInTargetWorkspaceBase->getPath() !== $shadowNodeData->getPath()) {
$this->adjustShadowNodePath($shadowNodeData, $nodeInTargetWorkspaceBase->getPath(), $targetWorkspace, $publishedNodeData->getDimensionValues());
}
}
示例7: 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);
}
示例8: createContextMatchingNodeData
/**
* Generates a Context that exactly fits the given NodeData Workspace and Dimensions.
*
* TODO: We could get more specific about removed and invisible content by adding some more logic here that generates fitting values.
*
* @param NodeData $nodeData
* @return Context
*/
public function createContextMatchingNodeData(NodeData $nodeData)
{
return $this->contextFactory->create(array('workspaceName' => $nodeData->getWorkspace()->getName(), 'invisibleContentShown' => true, 'inaccessibleContentShown' => true, 'removedContentShown' => true, 'dimensions' => $nodeData->getDimensionValues()));
}