You are here

public function SolrDocument::getItemUrl in Search API Solr 8.3

Same name and namespace in other branches
  1. 8.2 src/Plugin/search_api/datasource/SolrDocument.php \Drupal\search_api_solr\Plugin\search_api\datasource\SolrDocument::getItemUrl()
  2. 4.x src/Plugin/search_api/datasource/SolrDocument.php \Drupal\search_api_solr\Plugin\search_api\datasource\SolrDocument::getItemUrl()

Throws

\Drupal\Core\TypedData\Exception\MissingDataException

Overrides DatasourcePluginBase::getItemUrl

File

src/Plugin/search_api/datasource/SolrDocument.php, line 128

Class

SolrDocument
Represents a datasource which exposes external Solr Documents.

Namespace

Drupal\search_api_solr\Plugin\search_api\datasource

Code

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