protected function SearchApiFederatedSolrCanonicalUrl::addUrl in Search API Federated Solr 7
Same name and namespace in other branches
- 7.3 src/SearchApiFederatedSolrCanonicalUrl.php \SearchApiFederatedSolrCanonicalUrl::addUrl()
- 7.2 src/SearchApiFederatedSolrCanonicalUrl.php \SearchApiFederatedSolrCanonicalUrl::addUrl()
2 calls to SearchApiFederatedSolrCanonicalUrl::addUrl()
- SearchApiFederatedSolrCanonicalUrl::addDomainUrl in src/
SearchApiFederatedSolrCanonicalUrl.php - SearchApiFederatedSolrCanonicalUrl::alterItems in src/
SearchApiFederatedSolrCanonicalUrl.php - Alter items before indexing.
File
- src/
SearchApiFederatedSolrCanonicalUrl.php, line 48
Class
- SearchApiFederatedSolrCanonicalUrl
- Class SearchApiFederatedSolrCanonicalUrl Provides a Search API index data alteration that indicates the preferred URL content is available on to each indexed item.
Code
protected function addUrl(array &$items) {
foreach ($items as &$item) {
$url = $this->index
->datasource()
->getItemUrl($item);
if (!$url) {
$item->canonical_url = NULL;
continue;
}
$item->canonical_url = url($url['path'], array(
'absolute' => TRUE,
) + $url['options']);
}
}