function EntityViewsData::processViewsDataForLanguage

Same name in other branches
  1. 9 core/modules/views/src/EntityViewsData.php \Drupal\views\EntityViewsData::processViewsDataForLanguage()
  2. 8.9.x core/modules/views/src/EntityViewsData.php \Drupal\views\EntityViewsData::processViewsDataForLanguage()
  3. 11.x core/modules/views/src/EntityViewsData.php \Drupal\views\EntityViewsData::processViewsDataForLanguage()

Processes the views data for a language field.

Parameters

string $table: The table the language field is added to.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition.

array $views_field: The views field data.

string $field_column_name: The field column being processed.

File

core/modules/views/src/EntityViewsData.php, line 604

Class

EntityViewsData
Provides generic views integration for entities.

Namespace

Drupal\views

Code

protected function processViewsDataForLanguage($table, FieldDefinitionInterface $field_definition, array &$views_field, $field_column_name) {
    // Apply special titles for the langcode field.
    if ($field_definition->getName() == $this->entityType
        ->getKey('langcode')) {
        if ($table == $this->entityType
            ->getDataTable() || $table == $this->entityType
            ->getRevisionDataTable()) {
            $views_field['title'] = $this->t('Translation language');
        }
        if ($table == $this->entityType
            ->getBaseTable() || $table == $this->entityType
            ->getRevisionTable()) {
            $views_field['title'] = $this->t('Original language');
        }
    }
}

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