function LanguageNegotiator::isNegotiationMethodEnabled
Same name in other branches
- 8.9.x core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::isNegotiationMethodEnabled()
- 10 core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::isNegotiationMethodEnabled()
- 11.x core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::isNegotiationMethodEnabled()
Overrides LanguageNegotiatorInterface::isNegotiationMethodEnabled
File
-
core/
modules/ language/ src/ LanguageNegotiator.php, line 241
Class
- LanguageNegotiator
- Class responsible for performing language negotiation.
Namespace
Drupal\languageCode
public function isNegotiationMethodEnabled($method_id, $type = NULL) {
$enabled = FALSE;
$language_types = !empty($type) ? [
$type,
] : $this->languageManager
->getLanguageTypes();
foreach ($language_types as $type) {
$enabled_methods = $this->getEnabledNegotiators($type);
if (isset($enabled_methods[$method_id])) {
$enabled = TRUE;
break;
}
}
return $enabled;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.