findAll() public method

Returns an array of content dimensions that are available in the system.
public findAll ( ) : array<\Neos\ContentRepository\Domain\Model\ContentDimension>
return array<\Neos\ContentRepository\Domain\Model\ContentDimension>
 /**
  * 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);
 }
 /**
  * Returns TRUE if the given node has the default dimension values.
  *
  * @param NodeData $node
  * @return boolean
  */
 public function matches(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;
 }
Ejemplo n.º 3
0
 /**
  * Generate a "Sites.xml" for the given package and name.
  *
  * @param string $packageKey
  * @param string $siteName
  * @return void
  */
 protected function generateSitesXml($packageKey, $siteName)
 {
     $templatePathAndFilename = 'resource://Neos.SiteKickstarter/Private/Generator/Content/Sites.xml';
     $contextVariables = array();
     $contextVariables['packageKey'] = $packageKey;
     $contextVariables['siteName'] = htmlspecialchars($siteName);
     $packageKeyDomainPart = substr(strrchr($packageKey, '.'), 1) ?: $packageKey;
     $contextVariables['siteNodeName'] = strtolower($packageKeyDomainPart);
     $contextVariables['dimensions'] = $this->contentDimensionRepository->findAll();
     $fileContent = $this->renderTemplate($templatePathAndFilename, $contextVariables);
     $sitesXmlPathAndFilename = $this->packageManager->getPackage($packageKey)->getResourcesPath() . 'Private/Content/Sites.xml';
     $this->generateFile($sitesXmlPathAndFilename, $fileContent);
 }
 /**
  * @return array<\Neos\ContentRepository\Domain\Model\ContentDimension>
  */
 protected function getAvailableDimensions()
 {
     return $this->contentDimensionRepository->findAll();
 }