You are here

final class UserFormatNameAlterEvent in Hook Event Dispatcher 8

Class UserFormatNameAlterEvent.

Hierarchy

Expanded class hierarchy of UserFormatNameAlterEvent

2 files declare their use of UserFormatNameAlterEvent
hook_event_dispatcher.module in ./hook_event_dispatcher.module
Hook event dispatcher module.
UserEventTest.php in tests/src/Unit/User/UserEventTest.php

File

src/Event/User/UserFormatNameAlterEvent.php, line 13

Namespace

Drupal\hook_event_dispatcher\Event\User
View source
final class UserFormatNameAlterEvent extends Event implements EventInterface {

  /**
   * Name.
   *
   * @var string
   */
  private $name;

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

  /**
   * UserFormatNameAlterEvent constructor.
   *
   * @param string|\Drupal\Component\Render\MarkupInterface $name
   *   Name.
   * @param \Drupal\Core\Session\AccountInterface $account
   *   Account.
   */
  public function __construct(&$name, AccountInterface $account) {
    $this->name =& $name;
    $this->account = $account;
  }

  /**
   * Get the name by reference.
   *
   * @return string
   *   Name.
   */
  public function &getName() {
    return $this->name;
  }

  /**
   * Set the new name.
   *
   * @param string $name
   *   Name.
   */
  public function setName($name) {
    $this->name = $name;
  }

  /**
   * Get the account.
   *
   * @return \Drupal\Core\Session\AccountInterface
   *   Account.
   */
  public function getAccount() {
    return $this->account;
  }

  /**
   * Get the dispatcher type.
   *
   * @return string
   *   The dispatcher type.
   */
  public function getDispatcherType() {
    return HookEventDispatcherInterface::USER_FORMAT_NAME_ALTER;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
UserFormatNameAlterEvent::$account private property Account.
UserFormatNameAlterEvent::$name private property Name.
UserFormatNameAlterEvent::getAccount public function Get the account.
UserFormatNameAlterEvent::getDispatcherType public function Get the dispatcher type. Overrides EventInterface::getDispatcherType
UserFormatNameAlterEvent::getName public function Get the name by reference.
UserFormatNameAlterEvent::setName public function Set the new name.
UserFormatNameAlterEvent::__construct public function UserFormatNameAlterEvent constructor.