Uses an alias => service ID map to fetch content types from the dependency injection container.
상속: implements Sulu\Component\Content\ContentTypeManagerInterface, use trait Symfony\Component\DependencyInjection\ContainerAwareTrait
예제 #1
0
 private function getReferencedUuids(PropertyInterface $property)
 {
     $contentTypeName = $property->getContentTypeName();
     $contentType = $this->contentTypeManager->get($contentTypeName);
     $referencedUuids = $contentType->getReferencedUuids($property);
     return $referencedUuids;
 }
예제 #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);
 }
예제 #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']);
 }
예제 #4
0
파일: ContentMapper.php 프로젝트: sulu/sulu
 /**
  * Return the resource locator content type.
  *
  * @return ResourceLocatorInterface
  */
 public function getResourceLocator()
 {
     return $this->contentTypeManager->get('resource_locator');
 }