You are here

class LanguageNegotiationSelected in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationSelected
  2. 9 core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationSelected

Class for identifying language from a selected language.

Plugin annotation


@LanguageNegotiation(
  id = Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationSelected::METHOD_ID,
  weight = 12,
  name = @Translation("Selected language"),
  description = @Translation("Language based on a selected language."),
  config_route_name = "language.negotiation_selected"
)

Hierarchy

Expanded class hierarchy of LanguageNegotiationSelected

3 files declare their use of LanguageNegotiationSelected
LanguageNegotiationSessionTest.php in core/modules/language/tests/src/Functional/LanguageNegotiationSessionTest.php
LanguageUILanguageNegotiationTest.php in core/modules/language/tests/src/Functional/LanguageUILanguageNegotiationTest.php
NegotiationConfigureForm.php in core/modules/language/src/Form/NegotiationConfigureForm.php

File

core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php, line 19

Namespace

Drupal\language\Plugin\LanguageNegotiation
View source
class LanguageNegotiationSelected extends LanguageNegotiationMethodBase {

  /**
   * The language negotiation method id.
   */
  const METHOD_ID = 'language-selected';

  /**
   * {@inheritdoc}
   */
  public function getLangcode(Request $request = NULL) {
    $langcode = NULL;
    if ($this->languageManager) {
      $langcode = $this->config
        ->get('language.negotiation')
        ->get('selected_langcode');
    }
    return $langcode;
  }

}

Members