diff --git a/src/Controller/OAuth.php b/src/Controller/OAuth.php index ec99bad..a9cab1e 100644 --- a/src/Controller/OAuth.php +++ b/src/Controller/OAuth.php @@ -33,7 +33,7 @@ class OAuth extends ControllerBase { protected $messenger; /** - * Constructs a MyController object + * Constructs an OAuth object. * * @param \Drupal\hubspot_api\Services\OAuth $oauth_service * The OAuth service. @@ -68,7 +68,7 @@ class OAuth extends ControllerBase { * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function oauthRedirect() { - if (!isset($_GET['error']) && $_GET['error'] == 'access_denied') { + if (isset($_GET['error']) && $_GET['error'] == 'access_denied') { // Show error message if access was denied. $this->messenger->addError($this->t('Access was denied to HubSpot API.')); } diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 54631ba..cef489a 100755 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -55,49 +55,49 @@ class SettingsForm extends ConfigFormBase { $form['client_id'] = [ '#type' => 'textfield', - '#title' => t('Client ID'), + '#title' => $this->t('Client ID'), '#required' => TRUE, '#default_value' => $config->get('client_id'), ]; $form['client_secret'] = [ '#type' => 'textfield', - '#title' => t('Client secret'), + '#title' => $this->t('Client secret'), '#required' => TRUE, '#default_value' => $config->get('client_secret'), ]; $form['oauth'] = [ '#type' => 'fieldset', - '#title' => t('OAuth connection'), + '#title' => $this->t('OAuth connection'), ]; $form['oauth']['tokens'] = [ '#type' => 'details', - '#title' => t('Tokens'), + '#title' => $this->t('Tokens'), '#open' => TRUE, '#access' => (bool) $config->get('access_token') && $config->get('refresh_token'), ]; $form['oauth']['tokens']['access_token'] = [ '#type' => 'textfield', - '#title' => t('Access token'), + '#title' => $this->t('Access token'), '#required' => FALSE, '#default_value' => $config->get('access_token'), '#attributes' => ['readonly' => 'readonly'], ]; $form['oauth']['tokens']['refresh_token'] = [ '#type' => 'textfield', - '#title' => t('Refresh Token'), + '#title' => $this->t('Refresh Token'), '#required' => FALSE, '#default_value' => $config->get('refresh_token'), '#attributes' => ['readonly' => 'readonly'], ]; $form['oauth']['button'] = [ '#type' => 'submit', - '#value' => t('Authorize'), + '#value' => $this->t('Authorize'), '#submit' => ['::submitForm', '::oauthAuthorizeSubmit'], '#access' => (bool) !$config->get('access_token'), ]; $form['oauth']['disconnect'] = [ '#type' => 'submit', - '#value' => t('Disconnect'), + '#value' => $this->t('Disconnect'), '#limit_validation_errors' => [], '#submit' => ['::oauthDisconnectSubmit'], '#access' => (bool) $config->get('access_token'), @@ -105,7 +105,7 @@ class SettingsForm extends ConfigFormBase { $form['help'] = [ '#type' => 'details', - '#title' => t('Help'), + '#title' => $this->t('Help'), '#open' => FALSE, ]; $form['help']['list'] = [