class ConfigurableLanguageRenderer

Same name in other branches
  1. 9 core/modules/views/src/Entity/Render/ConfigurableLanguageRenderer.php \Drupal\views\Entity\Render\ConfigurableLanguageRenderer
  2. 8.9.x core/modules/views/src/Entity/Render/ConfigurableLanguageRenderer.php \Drupal\views\Entity\Render\ConfigurableLanguageRenderer
  3. 10 core/modules/views/src/Entity/Render/ConfigurableLanguageRenderer.php \Drupal\views\Entity\Render\ConfigurableLanguageRenderer

Renders entities in a configured language.

Hierarchy

Expanded class hierarchy of ConfigurableLanguageRenderer

File

core/modules/views/src/Entity/Render/ConfigurableLanguageRenderer.php, line 13

Namespace

Drupal\views\Entity\Render
View source
class ConfigurableLanguageRenderer extends EntityTranslationRendererBase {
    
    /**
     * A specific language code for rendering if available.
     *
     * @var string|null
     */
    protected $langcode;
    
    /**
     * Constructs a renderer object.
     *
     * @param \Drupal\views\ViewExecutable $view
     *   The entity row being rendered.
     * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
     *   The language manager.
     * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
     *   The entity type.
     * @param string|null $langcode
     *   A specific language code to set, if available.
     */
    public function __construct(ViewExecutable $view, LanguageManagerInterface $language_manager, EntityTypeInterface $entity_type, $langcode) {
        parent::__construct($view, $language_manager, $entity_type);
        $this->langcode = $langcode;
    }
    
    /**
     * {@inheritdoc}
     */
    public function getLangcode(ResultRow $row) {
        return $this->langcode;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
ConfigurableLanguageRenderer::$langcode protected property A specific language code for rendering if available.
ConfigurableLanguageRenderer::getLangcode public function Returns the language code associated with the given row. Overrides EntityTranslationRendererBase::getLangcode
ConfigurableLanguageRenderer::__construct public function Constructs a renderer object. Overrides RendererBase::__construct
EntityTranslationRendererBase::getEntity protected function Gets the entity associated with a row.
EntityTranslationRendererBase::getLangcodeByRelationship public function Returns the language code associated with the given row. 1
EntityTranslationRendererBase::preRender public function Runs before each entity is rendered. Overrides RendererBase::preRender
EntityTranslationRendererBase::preRenderByRelationship public function Runs before each entity is rendered if a relationship is needed. 1
EntityTranslationRendererBase::query public function Alters the query if needed. Overrides RendererBase::query 1
EntityTranslationRendererBase::render public function Renders entity data. Overrides RendererBase::render
EntityTranslationRendererBase::renderByRelationship public function Renders entity data. 1
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::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts 2
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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.