Example #1
0
 /**
  * Return items for given attributes.
  *
  * @param array $attributesByTag
  * @param string $locale
  * @param bool $published
  *
  * @return LinkItem[]
  */
 private function preload($attributesByTag, $locale, $published = true)
 {
     $hrefsByType = [];
     foreach ($attributesByTag as $attributes) {
         $provider = $this->getValue($attributes, 'provider', self::DEFAULT_PROVIDER);
         if (!array_key_exists($provider, $hrefsByType)) {
             $hrefsByType[$provider] = [];
         }
         $hrefsByType[$provider][] = $attributes['href'];
     }
     $result = [];
     foreach ($hrefsByType as $provider => $hrefs) {
         $items = $this->linkProviderPool->getProvider($provider)->preload(array_unique($hrefs), $locale, $published);
         foreach ($items as $item) {
             $result[$provider . '-' . $item->getId()] = $item;
         }
     }
     return $result;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function getParameters()
 {
     return $this->linkProviderPool->getConfiguration();
 }