Commit 84eac92b authored by Luhur Abdi Rizal's avatar Luhur Abdi Rizal
Browse files

Issue #3265541 by el7cosmos: Move user hook event constants to a class

parent 2be4c749
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
/**
 * Defines events for block hooks.
 */
class BlockHookEvents {
final class BlockHookEvents {

  /**
   * Alter the result of \Drupal\Core\Block\BlockBase::build().
+5 −3
Original line number Diff line number Diff line
@@ -2,10 +2,10 @@

namespace Drupal\user_event_dispatcher\Event\User;

use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Session\AccountInterface;
use Drupal\hook_event_dispatcher\Event\EventInterface;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Drupal\Component\EventDispatcher\Event;
use Drupal\user_event_dispatcher\UserHookEvents;

/**
 * Class UserCancelEvent.
@@ -18,12 +18,14 @@ final class UserCancelEvent extends Event implements EventInterface {
   * @var array
   */
  private $edit;

  /**
   * Account.
   *
   * @var \Drupal\Core\Session\AccountInterface
   */
  private $account;

  /**
   * The account cancellation method.
   *
@@ -84,7 +86,7 @@ final class UserCancelEvent extends Event implements EventInterface {
   *   The dispatcher type.
   */
  public function getDispatcherType(): string {
    return HookEventDispatcherInterface::USER_CANCEL;
    return UserHookEvents::USER_CANCEL;
  }

}
+3 −3
Original line number Diff line number Diff line
@@ -2,9 +2,9 @@

namespace Drupal\user_event_dispatcher\Event\User;

use Drupal\hook_event_dispatcher\Event\EventInterface;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Drupal\Component\EventDispatcher\Event;
use Drupal\hook_event_dispatcher\Event\EventInterface;
use Drupal\user_event_dispatcher\UserHookEvents;

/**
 * Class UserFormatNameAlterEvent.
@@ -45,7 +45,7 @@ final class UserCancelMethodsAlterEvent extends Event implements EventInterface
   *   The dispatcher type.
   */
  public function getDispatcherType(): string {
    return HookEventDispatcherInterface::USER_CANCEL_METHODS_ALTER;
    return UserHookEvents::USER_CANCEL_METHODS_ALTER;
  }

}
+4 −3
Original line number Diff line number Diff line
@@ -2,10 +2,10 @@

namespace Drupal\user_event_dispatcher\Event\User;

use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Session\AccountInterface;
use Drupal\hook_event_dispatcher\Event\EventInterface;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Drupal\Component\EventDispatcher\Event;
use Drupal\user_event_dispatcher\UserHookEvents;

/**
 * Class UserFormatNameAlterEvent.
@@ -18,6 +18,7 @@ final class UserFormatNameAlterEvent extends Event implements EventInterface {
   * @var string
   */
  private $name;

  /**
   * Account.
   *
@@ -65,7 +66,7 @@ final class UserFormatNameAlterEvent extends Event implements EventInterface {
   *   The dispatcher type.
   */
  public function getDispatcherType(): string {
    return HookEventDispatcherInterface::USER_FORMAT_NAME_ALTER;
    return UserHookEvents::USER_FORMAT_NAME_ALTER;
  }

}
+3 −3
Original line number Diff line number Diff line
@@ -2,10 +2,10 @@

namespace Drupal\user_event_dispatcher\Event\User;

use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Session\AccountInterface;
use Drupal\hook_event_dispatcher\Event\EventInterface;
use Drupal\hook_event_dispatcher\HookEventDispatcherInterface;
use Drupal\Component\EventDispatcher\Event;
use Drupal\user_event_dispatcher\UserHookEvents;

/**
 * Class UserLoginEvent.
@@ -46,7 +46,7 @@ final class UserLoginEvent extends Event implements EventInterface {
   *   The dispatcher type.
   */
  public function getDispatcherType(): string {
    return HookEventDispatcherInterface::USER_LOGIN;
    return UserHookEvents::USER_LOGIN;
  }

}
Loading