You are here

protected function GoogleTranslatorTestController::validateKey in TMGMT Translator Google 8

Key validator helper.

2 calls to GoogleTranslatorTestController::validateKey()
GoogleTranslatorTestController::availableLanguages in tmgmt_google_test/src/Controller/GoogleTranslatorTestController.php
Mock service to get available languages.
GoogleTranslatorTestController::translate in tmgmt_google_test/src/Controller/GoogleTranslatorTestController.php
Mok service to translate request.

File

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

Class

GoogleTranslatorTestController
Returns autocomplete responses for block categories.

Namespace

Drupal\tmgmt_google_test\Controller

Code

protected function validateKey(Request $request) {
  if ($request
    ->get('key') != 'correct key') {
    return $this
      ->trigger_response_error('usageLimits', 'keyInvalid', 'Bad Request');
  }
}