You are here

public function DomainLangHandler::getNegotiationMethods in Domain Lang 8

Returns the language negotiation methods enabled for a language type.

Parameters

string $type: (optional) The language type. If no type is specified all the method definitions are returned.

Return value

array[] An array of language negotiation method definitions keyed by method id.

Overrides DomainLangHandlerInterface::getNegotiationMethods

File

src/DomainLangHandler.php, line 248

Class

DomainLangHandler
Domain language handling.

Namespace

Drupal\domain_lang

Code

public function getNegotiationMethods($type = NULL) {
  $definitions = $this->negotiatorManager
    ->getDefinitions();
  if (isset($type)) {
    $enabled_methods = $this
      ->getLanguageTypesConfig()
      ->get('negotiation.' . $type . '.enabled') ?: [];
    $definitions = array_intersect_key($definitions, $enabled_methods);
  }
  return $definitions;
}