Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Aston Victor created an issue. See original summary.

AstonVictor’s picture

Status: Active » Needs review
FileSize
2.59 KB
pfrenssen’s picture

Issue tags: +Needs reroll

Thanks for working on this! The patch looks good apart from one remark, but this is already fixed in the meantime in 8.x-1.x. The patch also needs a reroll.

  1. diff --git a/src/Entity/Form/SiteAlertDeleteForm.php b/src/Entity/Form/SiteAlertDeleteForm.php
    index 164397a..eda81c4 100644
    --- a/src/Entity/Form/SiteAlertDeleteForm.php
    +++ b/src/Entity/Form/SiteAlertDeleteForm.php
    @@ -38,7 +38,7 @@ class SiteAlertDeleteForm extends ContentEntityConfirmFormBase {
       public function submitForm(array &$form, FormStateInterface $form_state) {
         $this->entity->delete();
     
    -    drupal_set_message($this->t('The Site Alert @label has been deleted.', ['@label' => $this->entity->label()]));
    +    \Drupal::messenger()->addMessage($this->t('The Site Alert @label has been deleted.', ['@label' => $this->entity->label()]));
    

    We should not call the \Drupal methods in object oriented classes. These methods are only for backwards compatibility with procedural code. This should use dependency injection instead. This has already been fixed in 8.x-1.x so this change can simply be removed.

pfrenssen’s picture

Rerolled against 8.x-1.x.

pfrenssen’s picture

Status: Needs review » Fixed

Tests are passing on Drupal 8 and on Drupal 9! Awesome, thanks a lot for the contribution!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.