You are here

class EntityTranslationRenderer in Search API 8

Renders entity translations in their row language.

Hierarchy

Expanded class hierarchy of EntityTranslationRenderer

File

src/Plugin/views/EntityTranslationRenderer.php, line 12

Namespace

Drupal\search_api\Plugin\views
View source
class EntityTranslationRenderer extends TranslationLanguageRenderer {

  /**
   * {@inheritdoc}
   */
  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();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityTranslationRenderer::getLangcode public function Returns the language code associated with the given row. Overrides TranslationLanguageRenderer::getLangcode
RendererBase::$build protected property Contains an array of render arrays, one for each rendered entity.
RendererBase::$entityType protected property The type of the entity being rendered.
RendererBase::$languageManager protected property The language manager.
RendererBase::$view public property The view executable wrapping the view storage entity.
RendererBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge
RendererBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags
RendererBase::__construct public function Constructs a renderer object. 2
TranslationLanguageRenderer::$langcodeAlias protected property Stores the field alias of the langcode column.
TranslationLanguageRenderer::getCacheContexts public function The cache contexts associated with this object. Overrides RendererBase::getCacheContexts
TranslationLanguageRenderer::getLangcodeTable protected function Returns the name of the table holding the "langcode" field.
TranslationLanguageRenderer::preRender public function Runs before each entity is rendered. Overrides EntityTranslationRendererBase::preRender
TranslationLanguageRenderer::query public function Alters the query if needed. Overrides EntityTranslationRendererBase::query
TranslationLanguageRenderer::render public function Renders entity data. Overrides EntityTranslationRendererBase::render