protected function EntityRow::getEntityTranslationRenderer in Views Parity Row 8
Returns the current renderer.
Return value
\Drupal\views_parity_row\Plugin\views\Entity\Render\RendererBase The configured renderer.
Overrides EntityTranslationRenderTrait::getEntityTranslationRenderer
File
- src/
Plugin/ views/ row/ EntityRow.php, line 159
Class
- EntityRow
- Generic entity row plugin to provide a common base for all entity types.
Namespace
Drupal\views_parity_row\Plugin\views\rowCode
protected function getEntityTranslationRenderer() {
if (!isset($this->entityLanguageRenderer)) {
$view = $this
->getView();
$rendering_language = $view->display_handler
->getOption('rendering_language');
$langcode = NULL;
$dynamic_renderers = [
'***LANGUAGE_entity_translation***' => 'TranslationLanguageRenderer',
'***LANGUAGE_entity_default***' => 'DefaultLanguageRenderer',
'***LANGUAGE_language_interface***' => 'CurrentLanguageRenderer',
];
if (isset($dynamic_renderers[$rendering_language])) {
// Dynamic language set based on result rows or instance defaults.
$renderer = $dynamic_renderers[$rendering_language];
}
else {
if (mb_strpos($rendering_language, '***LANGUAGE_') !== FALSE) {
$langcode = PluginBase::queryLanguageSubstitutions()[$rendering_language];
}
else {
// Specific langcode set.
$langcode = $rendering_language;
}
$renderer = 'ConfigurableLanguageRenderer';
}
$class = '\\Drupal\\views_parity_row\\Plugin\\views\\Entity\\Render\\' . $renderer;
$this->entityLanguageRenderer = new $class($view, $this
->getLanguageManager(), $this->entityType, $langcode);
}
return $this->entityLanguageRenderer;
}