annotate core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUI.php @ 19:fa3358dc1485 tip

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