Commit 964720f2 authored by Joachim Noreiko's avatar Joachim Noreiko
Browse files

Issue #3147984 by Project Update Bot, joachim: Automated Drupal 9 compatibility fixes.

parent 38a790b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
name: Mail
description: Provides a config entity for emails sent by the site.
type: module
core: 8.x
core_version_requirement: ^9
package: Mail
+6 −3
Original line number Diff line number Diff line
<?php

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;

/**
 * @file
 * Provides a working example of a module using Mail.
 */

/**
 * Implements hook_ENTITY_TYPE_access().
 */
function mail_example_mail_message_access(\Drupal\Core\Entity\EntityInterface $entity, $operation, \Drupal\Core\Session\AccountInterface $account) {
function mail_example_mail_message_access(EntityInterface $entity, $operation, AccountInterface $account) {
  // Allow access to messages in our group.
  if ($entity->group == 'mail_example') {
    return \Drupal\Core\Access\AccessResult::allowedIfHasPermission($account, 'edit mail_example mails');
    return AccessResult::allowedIfHasPermission($account, 'edit mail_example mails');
  }
}
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ class EntityMailer implements EntityMailerInterface {
        '%to' => $message['to'],
        '%reply' => $message['reply-to'] ? $message['reply-to'] : $this->t('not set'),
      ));
      drupal_set_message($this->t('Unable to send email. Contact the site administrator if the problem persists.'), 'error');
      \Drupal::messenger()->addError($this->t('Unable to send email. Contact the site administrator if the problem persists.'));
    }
  }

+3 −3
Original line number Diff line number Diff line
@@ -105,17 +105,17 @@ class MailMessageForm extends EntityForm {

    switch ($status) {
      case SAVED_NEW:
        drupal_set_message($this->t('Created the %label mail message.', [
        $this->messenger()->addStatus($this->t('Created the %label mail message.', [
          '%label' => $mail_message->label(),
        ]));
        break;

      default:
        drupal_set_message($this->t('Saved the %label mail message.', [
        $this->messenger()->addStatus($this->t('Saved the %label mail message.', [
          '%label' => $mail_message->label(),
        ]));
    }
    $form_state->setRedirectUrl($mail_message->urlInfo('collection'));
    $form_state->setRedirectUrl($mail_message->toUrl('collection'));
  }

}
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ class MailMessageGroupListController extends ControllerBase {
   *   A render array as expected by drupal_render().
   */
  public function listing($group) {
    $list_builder = $this->entityManager()->getListBuilder('mail_message');
    $list_builder = $this->entityTypeManager()->getListBuilder('mail_message');

    $list_builder->setGroup($group);
    $list_builder->setRedirect($this->getDestinationArray());