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

Breadcrumb

  1. Drupal Core 11.1.x

LanguageNegotiationUI.php

Namespace

Drupal\language\Plugin\LanguageNegotiation

File

core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php

View source
<?php

namespace Drupal\language\Plugin\LanguageNegotiation;

use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\language\Attribute\LanguageNegotiation;
use Drupal\language\LanguageNegotiationMethodBase;
use Symfony\Component\HttpFoundation\Request;

/**
 * Identifies the language from the interface text language selected for page.
 */
class LanguageNegotiationUI extends LanguageNegotiationMethodBase {
    
    /**
     * The language negotiation method id.
     */
    const METHOD_ID = 'language-interface';
    
    /**
     * {@inheritdoc}
     */
    public function getLangcode(?Request $request = NULL) {
        return $this->languageManager ? $this->languageManager
            ->getCurrentLanguage()
            ->getId() : NULL;
    }

}

Classes

Title Deprecated Summary
LanguageNegotiationUI Identifies the language from the interface text language selected for page.

API Navigation

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