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;
}