public function EntityTranslationRenderer::getLangcode in Search API 8
Returns the language code associated with the given row.
Parameters
\Drupal\views\ResultRow $row: The result row.
Return value
string A language code.
Overrides TranslationLanguageRenderer::getLangcode
File
- src/
Plugin/ views/ EntityTranslationRenderer.php, line 17
Class
- EntityTranslationRenderer
- Renders entity translations in their row language.
Namespace
Drupal\search_api\Plugin\viewsCode
public function getLangcode(ViewsResultRow $row) {
// If our normal query plugin is used, the fallback shouldn't really ever be
// needed, but if it is we fall back to the current request's content
// language.
return $row->search_api_language ?? $this->languageManager
->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)
->getId();
}