Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LanguageField.php

function LanguageField::render

Overrides FieldPluginBase::render

File

core/modules/views/src/Plugin/views/field/LanguageField.php, line 42

Class

LanguageField
Defines a field handler to translate a language into its readable form.

Namespace

Drupal\views\Plugin\views\field

Code

public function render(ResultRow $values) {
    $value = $this->getValue($values);
    $languages = $this->options['native_language'] ? \Drupal::languageManager()->getNativeLanguages() : \Drupal::languageManager()->getLanguages();
    return isset($languages[$value]) ? $languages[$value]->getName() : '';
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal