function LinkBase::addLangcode

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/field/LinkBase.php \Drupal\views\Plugin\views\field\LinkBase::addLangcode()
  2. 10 core/modules/views/src/Plugin/views/field/LinkBase.php \Drupal\views\Plugin\views\field\LinkBase::addLangcode()
  3. 11.x core/modules/views/src/Plugin/views/field/LinkBase.php \Drupal\views\Plugin\views\field\LinkBase::addLangcode()

Adds language information to the options.

Parameters

\Drupal\views\ResultRow $row: A view result row.

1 call to LinkBase::addLangcode()
LinkBase::renderLink in core/modules/views/src/Plugin/views/field/LinkBase.php
Prepares the link to view a entity.

File

core/modules/views/src/Plugin/views/field/LinkBase.php, line 233

Class

LinkBase
Field handler to present a link to an entity.

Namespace

Drupal\views\Plugin\views\field

Code

protected function addLangcode(ResultRow $row) {
    $entity = $this->getEntity($row);
    if ($this->languageManager
        ->isMultilingual()) {
        $this->options['alter']['language'] = $this->getEntityTranslation($entity, $row)
            ->language();
    }
}

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