Example #1
0
 /**
  * Returns a page identifier collection from the given settings key
  *
  * @param string $settingKey The settings key
  *
  * @return IdentifierCollection
  */
 private function getIdentifierCollectionFromSetting($settingKey)
 {
     $collection = $this->objectManager->get(IdentifierCollection::class);
     foreach ($this->settings[$settingKey] as $pid) {
         $identifier = Identifier::fromString($pid);
         $collection->add($identifier);
     }
     return $collection;
 }
 /**
  * Builds a Page from a TYPO3.CMS `pages` associative record array
  *
  * @param array $data
  *
  * @return Page
  *
  * @throws \InvalidArgumentException
  */
 public function createFromAssociativeArray(array $data)
 {
     $identifier = Identifier::fromString($data['uid']);
     $data['_pageId'] = $identifier;
     try {
         $data['_teaserImage'] = $this->teaserImageResourceFactory->createFromPageIdentifier($identifier);
     } catch (\InvalidArgumentException $exc) {
     }
     $page = $this->mapper->convert($data, Page::class, $this->mapperConfiguration);
     return $page;
 }
 /**
  * Resolves the base image resource string
  *
  * This method ensures that the page overlays, translations etc.
  * will be loaded by the TYPO3.CMS core for the specified field.
  *
  * @param Identifier $identifier
  *
  * @return Resource
  */
 public function createFromPageIdentifier(Identifier $identifier)
 {
     $configuration = ['references.' => ['table' => 'pages', 'uid' => $identifier->getValue(), 'fieldName' => 'media'], 'begin' => 0, 'maxItems' => 1, 'renderObj' => 'TEXT', 'renderObj.' => ['stdWrap.' => ['data' => 'file:current:publicUrl']]];
     return Resource::createFromPublicUrl($this->contentObjectRenderer->cObjGetSingle('FILES', $configuration));
 }