You are here

FlagEventBase.php in Flag 8.4

Namespace

Drupal\flag\Event

File

src/Event/FlagEventBase.php
View source
<?php

namespace Drupal\flag\Event;

use Drupal\flag\FlagInterface;
use Symfony\Component\EventDispatcher\Event;

/**
 * Base Event from which other flag event are defined.
 */
abstract class FlagEventBase extends Event {

  /**
   * The Flag in question.
   *
   * @var \Drupal\flag\FlagInterface
   */
  protected $flag;

  /**
   * Build the flag event class.
   *
   * @param \Drupal\flag\FlagInterface $flag
   *   The flag to be acted upon.
   */
  public function __construct(FlagInterface $flag) {
    $this->flag = $flag;
  }

  /**
   * Get the flag entity related to the event.
   *
   * @return \Drupal\flag\FlagInterface
   *   The flag related to the event.
   */
  public function getFlag() {
    return $this->flag;
  }

}

Classes

Namesort descending Description
FlagEventBase Base Event from which other flag event are defined.