You are here

public function SolrDocument::getItemLanguage in Search API Solr 8.2

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

Retrieves the item's language.

Parameters

\Drupal\Core\TypedData\ComplexDataInterface $item: An item of this datasource's type.

Return value

string The language code of this item.

Overrides DatasourcePluginBase::getItemLanguage

File

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

Class

SolrDocument
Represents a datasource which exposes external Solr Documents.

Namespace

Drupal\search_api_solr\Plugin\search_api\datasource

Code

public function getItemLanguage(ComplexDataInterface $item) {
  if ($this->configuration['language_field']) {
    return $this
      ->getFieldValue($item, 'language_field');
  }
  return parent::getItemLanguage($item);
}