You are here

public function RequestSubscriber::onRequest in Lightning API 8

Same name and namespace in other branches
  1. 8.4 src/RequestSubscriber.php \Drupal\lightning_api\RequestSubscriber::onRequest()
  2. 8.2 src/RequestSubscriber.php \Drupal\lightning_api\RequestSubscriber::onRequest()
  3. 8.3 src/RequestSubscriber.php \Drupal\lightning_api\RequestSubscriber::onRequest()

File

src/RequestSubscriber.php, line 53

Class

RequestSubscriber

Namespace

Drupal\lightning_api

Code

public function onRequest() {
  if ($this->routeMatch
    ->getRouteName() == 'oauth2_token.settings' && $this->key
    ->exists() == FALSE) {
    $url = Url::fromRoute('lightning_api.generate_keys');
    drupal_set_message($this
      ->t('You may wish to <a href=":generate_keys">generate a key pair</a> for OAuth authentication.', [
      ':generate_keys' => $url
        ->toString(),
    ]), 'warning');
  }
}