You are here

public function RulesEventHandlerEntityBundle::__construct in Rules 7.2

Implements RulesEventHandlerInterface::__construct().

Overrides RulesEventHandlerBase::__construct

File

includes/rules.event.inc, line 320
Contains event handler interface and base classes.

Class

RulesEventHandlerEntityBundle
Exposes the bundle of an entity as event setting.

Code

public function __construct($event_name, $info) {
  parent::__construct($event_name, $info);

  // Cut off the suffix, e.g. remove 'view' from node_view.
  $this->entityType = implode('_', explode('_', $event_name, -1));
  $this->entityInfo = entity_get_info($this->entityType);
  if (!$this->entityInfo) {
    throw new InvalidArgumentException('Unsupported event name passed.');
  }
}