FieldLanguage.php

Same filename in other branches
  1. 11.x core/modules/views/src/Plugin/views/field/FieldLanguage.php

Namespace

Drupal\views\Plugin\views\field

File

core/modules/views/src/Plugin/views/field/FieldLanguage.php

View source
<?php

namespace Drupal\views\Plugin\views\field;

use Drupal\Core\Session\AccountInterface;
use Drupal\views\Attribute\ViewsField;

/**
 * Displays the language of an entity.
 *
 * @ingroup views_field_handlers
 */
class FieldLanguage extends EntityField {
    
    /**
     * {@inheritdoc}
     */
    public function access(AccountInterface $account) : bool {
        // No point in displaying the language field on monolingual sites,
        // as only one language value is available.
        return $this->languageManager
            ->isMultilingual() && parent::access($account);
    }

}

Classes

Title Deprecated Summary
FieldLanguage Displays the language of an entity.

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