function RulesEventHandlerEntityBundle::__construct
Implements RulesEventHandlerInterface::__construct().
Overrides RulesEventHandlerBase::__construct
File
-
includes/
rules.event.inc, line 320
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.');
}
}