You are here

public function N1EDController::setApiKey in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2

Sets API key into Drupal config.

1 string reference to 'N1EDController::setApiKey'
n1ed.routing.yml in ./n1ed.routing.yml
n1ed.routing.yml

File

src/Controller/N1EDController.php, line 52

Class

N1EDController
Provides route responses for Flmngr file manager.

Namespace

Drupal\n1ed\Controller

Code

public function setApiKey() {
  $apiKey = $this->requestStack
    ->getCurrentRequest()->request
    ->get("n1edApiKey");
  $token = $this->requestStack
    ->getCurrentRequest()->request
    ->get("n1edToken");
  if ($apiKey == NULL || $token == NULL) {
    throw new AccessDeniedHttpException();
  }
  $config = $this->configFactory
    ->getEditable('n1ed.settings');
  $config
    ->set('apikey', $apiKey);
  $config
    ->set('token', $token);
  $config
    ->save(TRUE);
  return new Response();
}