public function SolrDocument::getItemUrl in Search API Solr 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/search_api/datasource/SolrDocument.php \Drupal\search_api_solr\Plugin\search_api\datasource\SolrDocument::getItemUrl()
- 4.x src/Plugin/search_api/datasource/SolrDocument.php \Drupal\search_api_solr\Plugin\search_api\datasource\SolrDocument::getItemUrl()
Retrieves a URL at which the item can be viewed on the web.
Parameters
\Drupal\Core\TypedData\ComplexDataInterface $item: An item of this datasource's type.
Return value
\Drupal\Core\Url|null Either an object representing the URL of the given item, or NULL if the item has no URL of its own.
Overrides DatasourcePluginBase::getItemUrl
File
- src/
Plugin/ search_api/ datasource/ SolrDocument.php, line 131
Class
- SolrDocument
- Represents a datasource which exposes external Solr Documents.
Namespace
Drupal\search_api_solr\Plugin\search_api\datasourceCode
public function getItemUrl(ComplexDataInterface $item) {
try {
return Url::fromUri($this
->getFieldValue($item, 'url_field'));
} catch (\InvalidArgumentException $e) {
// Log the exception and return NULL.
$this
->logException($e);
}
}