You are here

public function LanguageNegotiator::getPrimaryNegotiationMethod in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/src/LanguageNegotiator.php \Drupal\language\LanguageNegotiator::getPrimaryNegotiationMethod()

Returns the ID of the language type's primary language negotiation method.

Parameters

$type: The language type.

Return value

string The identifier of the primary language negotiation method for the given language type, or the default method if none exists.

Overrides LanguageNegotiatorInterface::getPrimaryNegotiationMethod

File

core/modules/language/src/LanguageNegotiator.php, line 227
Contains \Drupal\language\LanguageNegotiator.

Class

LanguageNegotiator
Class responsible for performing language negotiation.

Namespace

Drupal\language

Code

public function getPrimaryNegotiationMethod($type) {
  $enabled_methods = $this
    ->getEnabledNegotiators($type);
  return empty($enabled_methods) ? LanguageNegotiatorInterface::METHOD_ID : key($enabled_methods);
}