comparison core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\language\Plugin\LanguageNegotiation;
4
5 use Drupal\language\LanguageNegotiationMethodBase;
6 use Symfony\Component\HttpFoundation\Request;
7
8 /**
9 * Identifies the language from the interface text language selected for page.
10 *
11 * @LanguageNegotiation(
12 * id = Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI::METHOD_ID,
13 * types = {Drupal\Core\Language\LanguageInterface::TYPE_CONTENT},
14 * weight = 9,
15 * name = @Translation("Interface"),
16 * description = @Translation("Use the detected interface language.")
17 * )
18 */
19 class LanguageNegotiationUI extends LanguageNegotiationMethodBase {
20
21 /**
22 * The language negotiation method id.
23 */
24 const METHOD_ID = 'language-interface';
25
26 /**
27 * {@inheritdoc}
28 */
29 public function getLangcode(Request $request = NULL) {
30 return $this->languageManager ? $this->languageManager->getCurrentLanguage()->getId() : NULL;
31 }
32
33 }