Uses an alias => service ID map to fetch content types from the dependency injection container.
Inheritance: implements Sulu\Component\Content\ContentTypeManagerInterface, use trait Symfony\Component\DependencyInjection\ContainerAwareTrait
Beispiel #1
0
 private function getReferencedUuids(PropertyInterface $property)
 {
     $contentTypeName = $property->getContentTypeName();
     $contentType = $this->contentTypeManager->get($contentTypeName);
     $referencedUuids = $contentType->getReferencedUuids($property);
     return $referencedUuids;
 }
Beispiel #2
0
 /**
  * TODO: Move this to ResourceLocator repository>.
  *
  * {@inheritdoc}
  */
 public function restoreHistoryPath($path, $userId, $webspaceKey, $locale, $segmentKey = null)
 {
     $this->strategy->restoreByPath($path, $webspaceKey, $locale, $segmentKey);
     $content = $this->loadByResourceLocator($path, $webspaceKey, $locale, $segmentKey);
     $property = $content->getPropertyByTagName('sulu.rlp');
     $property->setValue($path);
     $node = $this->sessionManager->getSession()->getNodeByIdentifier($content->getUuid());
     $contentType = $this->contentTypeManager->get($property->getContentTypeName());
     $contentType->write($node, new TranslatedProperty($property, $locale, $this->namespaceRegistry->getPrefix('content_localized')), $userId, $webspaceKey, $locale, $segmentKey);
 }
Beispiel #3
0
 public function testLoadWithSmartContent()
 {
     $startPage = $this->mapper->loadStartPage('sulu_io', 'de');
     $data = ContentMapperRequest::create('page')->setLocale('de')->setTemplateKey('overview_smart_content')->setData(['title' => 'Testname', 'tags' => ['tag1', 'tag2'], 'url' => '/news', 'article' => 'sulu_io', 'smartcontent' => ['dataSource' => $startPage->getUuid()]])->setWebspaceKey('sulu_io')->setState(Structure::STATE_PUBLISHED)->setUserId(1);
     $structure = $this->mapper->saveRequest($data);
     $childData = ContentMapperRequest::create('page')->setLocale('de')->setTemplateKey('default')->setData(['title' => 'Testname', 'url' => '/news/child', 'article' => 'sulu_io'])->setWebspaceKey('sulu_io')->setState(Structure::STATE_PUBLISHED)->setUserId(1);
     $childStructure = $this->mapper->saveRequest($childData);
     $content = $this->mapper->load($structure->getUuid(), 'sulu_io', 'de');
     $smartContentType = $this->contentTypeManager->get('smart_content');
     $smartContentData = $smartContentType->getContentData($content->getProperty('smartcontent'));
     $this->assertInstanceOf('DateTime', $smartContentData[0]['published']);
 }
Beispiel #4
0
 /**
  * Return the resource locator content type.
  *
  * @return ResourceLocatorInterface
  */
 public function getResourceLocator()
 {
     return $this->contentTypeManager->get('resource_locator');
 }