loadIdentifier() public method

Loads identifier for given type.
public loadIdentifier ( string $webspaceKey, string $type ) : string
$webspaceKey string
$type string
return string
コード例 #1
0
 public function getDefault($snippetType, $webspaceKey = null, $locale = null)
 {
     if (!$webspaceKey) {
         $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
     }
     if (!$locale) {
         $locale = $this->requestAnalyzer->getCurrentLocalization()->getLocalization();
     }
     $ids = [$this->defaultSnippetManager->loadIdentifier($webspaceKey, $snippetType)];
     // to filter null default snippet
     $ids = array_filter($ids);
     return $this->snippetResolver->resolve($ids, $webspaceKey, $locale);
 }
コード例 #2
0
ファイル: SnippetContent.php プロジェクト: sulu/sulu
 /**
  * Returns snippets with given property value.
  */
 private function getSnippets(PropertyInterface $property)
 {
     /** @var PageBridge $page */
     $page = $property->getStructure();
     $webspaceKey = $page->getWebspaceKey();
     $locale = $page->getLanguageCode();
     $shadowLocale = null;
     if ($page->getIsShadow()) {
         $shadowLocale = $page->getShadowBaseLanguage();
     }
     $refs = $property->getValue();
     $ids = $this->getUuids($refs);
     $snippetType = $this->getParameterValue($property->getParams(), 'snippetType');
     $default = $this->getParameterValue($property->getParams(), 'default', false);
     if (empty($ids) && $snippetType && $default && $this->defaultEnabled) {
         $ids = [$this->defaultSnippetManager->loadIdentifier($webspaceKey, $snippetType)];
         // to filter null default snippet
         $ids = array_filter($ids);
     }
     return $this->snippetResolver->resolve($ids, $webspaceKey, $locale, $shadowLocale);
 }