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

Breadcrumb

  1. Drupal Core 11.1.x

LanguageNegotiationSelected.php

Namespace

Drupal\language\Plugin\LanguageNegotiation

File

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

View source
<?php

namespace Drupal\language\Plugin\LanguageNegotiation;

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

/**
 * Class for identifying language from a selected language.
 */
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;
    }

}

Classes

Title Deprecated Summary
LanguageNegotiationSelected Class for identifying language from a selected language.

API Navigation

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