resolve() 공개 메소드

Load snippet and resolves them by UUID.
public resolve ( string[] $uuids, string $webspaceKey, string $locale, string $shadowLocale = null ) : array
$uuids string[]
$webspaceKey string
$locale string
$shadowLocale string
리턴 array
예제 #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
 /**
  * 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);
 }