class RulesMediaEvent in Scheduler 2.x
Class for all Rules media events.
Hierarchy
- class \Drupal\Component\EventDispatcher\Event extends \Symfony\Component\EventDispatcher\Event
- class \Drupal\scheduler_rules_integration\Event\EventBase
- class \Drupal\scheduler_rules_integration\Event\RulesMediaEvent
- class \Drupal\scheduler_rules_integration\Event\EventBase
Expanded class hierarchy of RulesMediaEvent
File
- scheduler_rules_integration/
src/ Event/ RulesMediaEvent.php, line 10
Namespace
Drupal\scheduler_rules_integration\EventView source
class RulesMediaEvent extends EventBase {
/**
* Define constants to convert the event identifier into the full event name.
*
* The final event names here are defined in the event deriver and are
* different in format from the event names for node events, as originally
* coded long-hand in scheduler_rules_integration.rules.events.yml.
* However, the identifiers (CRON_PUBLISHED, NEW_FOR_PUBLISHING, etc) are the
* same for all types and this is how the actual event names are retrieved.
*/
const CRON_PUBLISHED = 'scheduler:media_has_been_published_via_cron';
const CRON_UNPUBLISHED = 'scheduler:media_has_been_unpublished_via_cron';
const NEW_FOR_PUBLISHING = 'scheduler:new_media_is_scheduled_for_publishing';
const NEW_FOR_UNPUBLISHING = 'scheduler:new_media_is_scheduled_for_unpublishing';
const EXISTING_FOR_PUBLISHING = 'scheduler:existing_media_is_scheduled_for_publishing';
const EXISTING_FOR_UNPUBLISHING = 'scheduler:existing_media_is_scheduled_for_unpublishing';
/**
* The media item which is being processed.
*
* @var \Drupal\media\MediaInterface
*/
public $media;
/**
* Constructs the object.
*
* @param \Drupal\media\MediaInterface $media
* The media item which is being processed.
*/
public function __construct(MediaInterface $media) {
$this->media = $media;
}
/**
* Returns the entity which is being processed.
*/
public function getEntity() {
// The Rules module requires the entity to be stored in a specifically named
// property which will obviously vary according to the entity type being
// processed. This generic getEntity() method is not strictly required by
// Rules but is added for convenience when manipulating the event entity.
return $this->media;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RulesMediaEvent:: |
public | property | The media item which is being processed. | |
RulesMediaEvent:: |
constant | Define constants to convert the event identifier into the full event name. | ||
RulesMediaEvent:: |
constant | |||
RulesMediaEvent:: |
constant | |||
RulesMediaEvent:: |
constant | |||
RulesMediaEvent:: |
public | function | Returns the entity which is being processed. | |
RulesMediaEvent:: |
constant | |||
RulesMediaEvent:: |
constant | |||
RulesMediaEvent:: |
public | function | Constructs the object. |