function LanguageNegotiator::isNegotiationMethodEnabled

Same name in other branches
  1. 9 core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::isNegotiationMethodEnabled()
  2. 8.9.x core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::isNegotiationMethodEnabled()
  3. 11.x core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::isNegotiationMethodEnabled()

File

core/modules/language/src/LanguageNegotiator.php, line 241

Class

LanguageNegotiator
Class responsible for performing language negotiation.

Namespace

Drupal\language

Code

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.