You are here

public function OperationLanguageNegotiation::getLangcode in GraphQL 8.4

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

src/Plugin/LanguageNegotiation/OperationLanguageNegotiation.php, line 43

Class

OperationLanguageNegotiation
Class for identifying language based on a graphql query.

Namespace

Drupal\graphql\Plugin\LanguageNegotiation

Code

public function getLangcode(Request $request = NULL) {
  if (!empty(static::$context)) {
    return static::$context
      ->getContextLanguage();
  }
  return FALSE;
}