class IncidentReportEvent in Examples for Developers 3.x
Same name and namespace in other branches
- 8 events_example/src/Event/IncidentReportEvent.php \Drupal\events_example\Event\IncidentReportEvent
Wraps a incident report event for event subscribers.
Whenever there is additional contextual data that you want to provide to the event subscribers when dispatching an event you should create a new class that extends \Symfony\Component\EventDispatcher\Event.
See \Drupal\Core\Config\ConfigCrudEvent for an example of this in core.
Hierarchy
- class \Drupal\events_example\Event\IncidentReportEvent extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of IncidentReportEvent
See also
\Drupal\Core\Config\ConfigCrudEvent
Related topics
2 files declare their use of IncidentReportEvent
- EventsExampleForm.php in modules/
events_example/ src/ Form/ EventsExampleForm.php - EventsExampleSubscriber.php in modules/
events_example/ src/ EventSubscriber/ EventsExampleSubscriber.php
File
- modules/
events_example/ src/ Event/ IncidentReportEvent.php, line 20
Namespace
Drupal\events_example\EventView source
class IncidentReportEvent extends Event {
/**
* Incident type.
*
* @var string
*/
protected $type;
/**
* Detailed incident report.
*
* @var string
*/
protected $report;
/**
* Constructs an incident report event object.
*
* @param string $type
* The incident report type.
* @param string $report
* A detailed description of the incident provided by the reporter.
*/
public function __construct($type, $report) {
$this->type = $type;
$this->report = $report;
}
/**
* Get the incident type.
*
* @return string
* The type of report.
*/
public function getType() {
return $this->type;
}
/**
* Get the detailed incident report.
*
* @return string
* The text of the report.
*/
public function getReport() {
return $this->report;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
IncidentReportEvent:: |
protected | property | Detailed incident report. | |
IncidentReportEvent:: |
protected | property | Incident type. | |
IncidentReportEvent:: |
public | function | Get the detailed incident report. | |
IncidentReportEvent:: |
public | function | Get the incident type. | |
IncidentReportEvent:: |
public | function | Constructs an incident report event object. |