function MailCancelTestHooks::mailAlter

Implements hook_mail_alter().

Aborts sending of messages with ID 'mail_cancel_test_cancel_test'.

See also

MailTestCase::testCancelMessage()

File

core/modules/system/tests/modules/mail_cancel_test/src/Hook/MailCancelTestHooks.php, line 21

Class

MailCancelTestHooks
Hook implementations for mail_cancel_test.

Namespace

Drupal\mail_cancel_test\Hook

Code

public function mailAlter(&$message) : void {
    if ($message['id'] == 'mail_cancel_test_cancel_test') {
        $message['send'] = FALSE;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.