Commit 2aeacae6 authored by Gaurav Kapoor's avatar Gaurav Kapoor Committed by Gaurav Kapoor
Browse files

Issue #3238660 by gaurav.kapoor: TypeError on 8.x-1.2 version

parent 2bd89966
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
name: 'Email Blocker'
type: module
description: 'Email Blocker blocks all outgoing emails based on the configuration setting.'
core: 8.x
core_version_requirement: ^8 || ^9
core_version_requirement: ^8.8 || ^9
configure : email_blocker.email_blocker_settings_form
package: 'Mail'
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ function email_blocker_mail_alter(&$message) {
    $message['send'] = FALSE;
  }
  if ($config->get('block_email_display_email') != FALSE) {
    print_r($message['body']);
    exit;
    // Logs the email message object as a JSON in recent log messages.
    \Drupal::logger('email_blocker')->notice(json_encode($message));
  }
}

email_blocker.services.yml

deleted100644 → 0
+0 −5
Original line number Diff line number Diff line
services:
  email_blocker.subscriber:
    class: Drupal\email_blocker\EventSubscriber\SiteExit
    tags:
      - {name: event_subscriber}

src/EventSubscriber/SiteExit.php

deleted100644 → 0
+0 −30
Original line number Diff line number Diff line
<?php

namespace Drupal\email_blocker\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

class SiteExit implements EventSubscriberInterface {

  public function terminate(ResponseEvent $event) {

   /* $response = $event->getResponse();
    if (!headers_sent()) {
      foreach (headers_list() as $header)
        header_remove($header);
    }
    */
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events[KernelEvents::RESPONSE][] = array('terminate');
    return $events;
  }

}
+2 −2
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * Class EmailBlockerSettingsForm.
 * Class which provides the settings form for the module.
 */
class EmailBlockerSettingsForm extends ConfigFormBase {