You are here

class RulesNodeEvent in Scheduler 2.x

Class for all Rules node events.

Hierarchy

  • class \Drupal\Component\EventDispatcher\Event extends \Symfony\Component\EventDispatcher\Event
    • class \Drupal\scheduler_rules_integration\Event\EventBase

Expanded class hierarchy of RulesNodeEvent

File

scheduler_rules_integration/src/Event/RulesNodeEvent.php, line 10

Namespace

Drupal\scheduler_rules_integration\Event
View source
class RulesNodeEvent extends EventBase {

  /**
   * Define constants to convert the event identifier into the full event name.
   *
   * To retain backwards compatibility the event names for node events remain as
   * originally specified in scheduler_rules_integration.rules.events.yml. The
   * format is different from the new events derived for other entity types.
   * 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_has_published_this_node_event';
  const CRON_UNPUBLISHED = 'scheduler_has_unpublished_this_node_event';
  const NEW_FOR_PUBLISHING = 'scheduler_new_node_is_scheduled_for_publishing_event';
  const NEW_FOR_UNPUBLISHING = 'scheduler_new_node_is_scheduled_for_unpublishing_event';
  const EXISTING_FOR_PUBLISHING = 'scheduler_existing_node_is_scheduled_for_publishing_event';
  const EXISTING_FOR_UNPUBLISHING = 'scheduler_existing_node_is_scheduled_for_unpublishing_event';

  /**
   * The node which is being processed.
   *
   * @var \Drupal\node\NodeInterface
   */
  public $node;

  /**
   * Constructs the object.
   *
   * @param \Drupal\node\NodeInterface $node
   *   The node which is being processed.
   */
  public function __construct(NodeInterface $node) {
    $this->node = $node;
  }

  /**
   * 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->node;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RulesNodeEvent::$node public property The node which is being processed.
RulesNodeEvent::CRON_PUBLISHED constant Define constants to convert the event identifier into the full event name.
RulesNodeEvent::CRON_UNPUBLISHED constant
RulesNodeEvent::EXISTING_FOR_PUBLISHING constant
RulesNodeEvent::EXISTING_FOR_UNPUBLISHING constant
RulesNodeEvent::getEntity public function Returns the entity which is being processed.
RulesNodeEvent::NEW_FOR_PUBLISHING constant
RulesNodeEvent::NEW_FOR_UNPUBLISHING constant
RulesNodeEvent::__construct public function Constructs the object.