You are here

public function GoogleTranslatorTestController::availableLanguages in TMGMT Translator Google 8

Mock service to get available languages.

1 string reference to 'GoogleTranslatorTestController::availableLanguages'
tmgmt_google_test.routing.yml in tmgmt_google_test/tmgmt_google_test.routing.yml
tmgmt_google_test/tmgmt_google_test.routing.yml

File

tmgmt_google_test/src/Controller/GoogleTranslatorTestController.php, line 21
Contains \Drupal\block\Controller\CategoryAutocompleteController.

Class

GoogleTranslatorTestController
Returns autocomplete responses for block categories.

Namespace

Drupal\tmgmt_google_test\Controller

Code

public function availableLanguages(Request $request) {
  if ($response = $this
    ->validateKey($request)) {
    return $response;
  }
  $response = array(
    'data' => array(
      'languages' => array(
        array(
          'language' => 'en',
        ),
        array(
          'language' => 'de',
        ),
        array(
          'language' => 'fr',
        ),
      ),
    ),
  );
  return new JsonResponse($response);
}