From 7185cbacce384e080e0cb24a29ae7314d2f88bbc Mon Sep 17 00:00:00 2001 From: Melissa Bent Date: Tue, 9 May 2017 10:23:43 -0600 Subject: [PATCH] Remove deprecated 'l' function and replace with core Link generator. Remove dependency on dblog from settings form log description to prevent errors when dblog is not enabled. --- src/Form/MandrillAdminSettingsForm.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Form/MandrillAdminSettingsForm.php b/src/Form/MandrillAdminSettingsForm.php index 01cc1aa..6802eb5 100644 --- a/src/Form/MandrillAdminSettingsForm.php +++ b/src/Form/MandrillAdminSettingsForm.php @@ -7,6 +7,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Mail\MailManagerInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Path\PathValidatorInterface; +use Drupal\Core\Link; use Drupal\Core\Url; use Drupal\Core\Render\RendererInterface; use Drupal\mandrill\MandrillServiceInterface; @@ -98,7 +99,7 @@ class MandrillAdminSettingsForm extends ConfigFormBase { $form['mandrill_api_key'] = array( '#title' => t('Mandrill API Key'), '#type' => 'textfield', - '#description' => t('Create or grab your API key from the %link.', array('%link' => $this->l(t('Mandrill settings'), Url::fromUri('https://mandrillapp.com/settings/index')))), + '#description' => t('Create or grab your API key from the %link.', array('%link' => Link::fromTextAndUrl(t('Mandrill settings'), Url::fromUri('https://mandrillapp.com/settings/index'))->toString())), '#default_value' => $key, ); if (!$this->mandrillAPI->isLibraryInstalled()) { @@ -129,7 +130,7 @@ class MandrillAdminSettingsForm extends ConfigFormBase { '#markup' => t('Mandrill is currently configured to be used by the following Module Keys. To change these settings or ' . 'configure additional systems to use Mandrill, use %link.

%table', array( - '%link' => $this->l(t('Mail System'), $mailSystemPath), + '%link' => Link::fromTextAndUrl(t('Mail System'), $mailSystemPath)->toString(), '%table' => $this->renderer->render($usage_array), )), ); @@ -139,7 +140,7 @@ class MandrillAdminSettingsForm extends ConfigFormBase { 'PLEASE NOTE: Mandrill is not currently configured for use by Drupal. In order to route your email through Mandrill, ' . 'you must configure at least one MailSystemInterface (other than mandrill) to use "MandrillMailSystem" in %link, or ' . 'you will only be able to send Test Emails through Mandrill.', - array('%link' => $this->l(t('Mail System'), $mailSystemPath))), 'warning'); + array('%link' => Link::fromTextAndUrl(t('Mail System'), $mailSystemPath)->toString())), 'warning'); } $form['email_options'] = array( '#type' => 'fieldset', @@ -223,16 +224,17 @@ class MandrillAdminSettingsForm extends ConfigFormBase { '#description' => t('Comma delimited list of Drupal mail keys to exclude content logging for. CAUTION: Removing the default password reset key may expose a security risk.'), '#default_value' => $config->get('mandrill_mail_key_blacklist'), ); + $form['send_options']['mandrill_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 Mandrill as the site-wide default email sender in %mailsystem and check this box, any messages that are sent through Mandrill using module/key pairs that are not specifically registered in mailsystem will cause a message to be written to the %systemlog (type: Mandrill, 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 Mandrill and can clog your logs.', + '#description' => t('If you select Mandrill as the site-wide default email sender in %mailsystem and check this box, any messages that are sent through Mandrill using module/key pairs that are not specifically registered in mailsystem will cause a message to be written to the system log (type: Mandrill, 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 Mandrill and can clog your logs.', array( - '%mailsystem' => $this->l(t('Mail System'), $mailSystemPath), - '%systemlog' => $this->l(t('system log'), Url::fromRoute('dblog.overview')), + '%mailsystem' => Link::fromTextAndUrl(t('Mail System'), $mailSystemPath)->toString(), )), '#default_value' => $config->get('mandrill_log_defaulted_sends'), ); + $form['analytics'] = array( '#type' => 'fieldset', '#collapsible' => TRUE, -- 2.9.2