public function LanguageNegotiationSelected::getLangcode in Drupal 8
Same name and namespace in other branches
- 9 core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationSelected.php \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationSelected::getLangcode()
Performs language negotiation.
Parameters
\Symfony\Component\HttpFoundation\Request $request: (optional) The current request. Defaults to NULL if it has not been initialized yet.
Return value
string A valid language code or FALSE if the negotiation was unsuccessful.
Overrides LanguageNegotiationMethodInterface::getLangcode
File
- core/
modules/ language/ src/ Plugin/ LanguageNegotiation/ LanguageNegotiationSelected.php, line 29
Class
- LanguageNegotiationSelected
- Class for identifying language from a selected language.
Namespace
Drupal\language\Plugin\LanguageNegotiationCode
public function getLangcode(Request $request = NULL) {
$langcode = NULL;
if ($this->languageManager) {
$langcode = $this->config
->get('language.negotiation')
->get('selected_langcode');
}
return $langcode;
}