diff --git a/README.md b/README.md index 7414d5b..9dec8b6 100644 --- a/README.md +++ b/README.md @@ -25,5 +25,5 @@ Composer Manager (https://drupal.org/project/composer_manager) You could install and enable SendGrid PHP Library with Composer Manager. If not, module will try to find sendgrid/vendor/autoload.php file and SendGrid class. -Then enable module as usual and enter SendGrid API key in module settings. And enable module to be used in Mail System settings. +Then enable module as usual and enter your SendGrid API key in the module settings. Also configure your site's Mail System settings to use Sendgrid. diff --git a/src/Form/SendgridAdminSettingsForm.php b/src/Form/SendgridAdminSettingsForm.php index 70160c8..390249a 100644 --- a/src/Form/SendgridAdminSettingsForm.php +++ b/src/Form/SendgridAdminSettingsForm.php @@ -201,13 +201,20 @@ public function buildForm(array $form, FormStateInterface $form_state) { // '#description' => t('Whether or not to strip the query string from URLs when aggregating tracked URL data.'), // '#default_value' => $config->get('sendgrid_url_strip_qs'), // ); + if (\Drupal::moduleHandler()->moduleExists('dblog')) { + $log_url = Url::fromRoute('dblog.overview'); + } elseif (\Drupal::moduleHandler()->moduleExists('syslog') && \Drupal::moduleHandler()->moduleExists('help')) { + $log_url = new Url('help.page', ['name' => 'syslog']); + } else { + $log_url = 'https://drupal.org/page-that-needs-to-exist-on-simply-enabling-dblog-syslog-or-other-compatible-logger'; + } $form['send_options']['sendgrid_log_defaulted_sends'] = array( '#title' => t('Log sends from module/key pairs that are not registered independently in mailsystem.'), '#type' => 'checkbox', '#description' => t('If you select Sendgrid as the site-wide default email sender in %mailsystem and check this box, any messages that are sent through Sendgrid using module/key pairs that are not specifically registered in mailsystem will cause a message to be written to the %systemlog (type: Sendgrid, severity: info). Enable this to identify keys and modules for automated emails for which you would like to have more granular control. It is not recommended to leave this box checked for extended periods, as it slows Sendgrid and can clog your logs.', array( '%mailsystem' => $this->l(t('Mail System'), $mailSystemPath), - '%systemlog' => $this->l(t('system log'), Url::fromRoute('dblog.overview')), + '%systemlog' => $this->l(t('system log'), $log_url), )), '#default_value' => $config->get('sendgrid_log_defaulted_sends'), );