class RulesEventHandlerBase
Base class for event handler.
Hierarchy
- class \RulesEventHandlerBase implements \RulesEventHandlerInterface
Expanded class hierarchy of RulesEventHandlerBase
File
-
includes/
rules.event.inc, line 180
View source
abstract class RulesEventHandlerBase implements RulesEventHandlerInterface {
/**
* The event name.
*
* @var string
*/
protected $eventName;
/**
* The event info.
*
* @var array
*/
protected $eventInfo;
/**
* The event settings.
*
* @var array
*/
protected $settings = array();
/**
* Implements RulesEventHandlerInterface::__construct().
*/
public function __construct($event_name, $info) {
$this->eventName = $event_name;
$this->eventInfo = $info;
$this->settings = $this->getDefaults();
}
/**
* Implements RulesEventHandlerInterface::getSettings().
*/
public function getSettings() {
return $this->settings;
}
/**
* Implements RulesEventHandlerInterface::setSettings().
*/
public function setSettings(array $settings) {
$this->settings = $settings + $this->getDefaults();
return $this;
}
/**
* Implements RulesEventHandlerInterface::validate().
*/
public function validate() {
// Nothing to check by default.
}
/**
* Implements RulesEventHandlerInterface::extractFormValues().
*/
public function extractFormValues(array &$form, array &$form_state) {
foreach ($this->getDefaults() as $key => $setting) {
$this->settings[$key] = isset($form_state['values'][$key]) ? $form_state['values'][$key] : $setting;
}
}
/**
* Implements RulesEventHandlerInterface::availableVariables().
*/
public function availableVariables() {
return isset($this->eventInfo['variables']) ? $this->eventInfo['variables'] : array();
}
/**
* Implements RulesEventHandlerInterface::getEventName().
*/
public function getEventName() {
return $this->eventName;
}
/**
* Implements RulesEventHandlerInterface::getEventInfo().
*/
public function getEventInfo() {
return $this->eventInfo;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
RulesEventHandlerBase::$eventInfo | protected | property | The event info. | ||
RulesEventHandlerBase::$eventName | protected | property | The event name. | ||
RulesEventHandlerBase::$settings | protected | property | The event settings. | ||
RulesEventHandlerBase::availableVariables | public | function | Implements RulesEventHandlerInterface::availableVariables(). | Overrides RulesEventHandlerInterface::availableVariables | 1 |
RulesEventHandlerBase::extractFormValues | public | function | Implements RulesEventHandlerInterface::extractFormValues(). | Overrides RulesEventHandlerInterface::extractFormValues | 1 |
RulesEventHandlerBase::getEventInfo | public | function | Implements RulesEventHandlerInterface::getEventInfo(). | Overrides RulesEventHandlerInterface::getEventInfo | |
RulesEventHandlerBase::getEventName | public | function | Implements RulesEventHandlerInterface::getEventName(). | Overrides RulesEventHandlerInterface::getEventName | |
RulesEventHandlerBase::getSettings | public | function | Implements RulesEventHandlerInterface::getSettings(). | Overrides RulesEventHandlerInterface::getSettings | 1 |
RulesEventHandlerBase::setSettings | public | function | Implements RulesEventHandlerInterface::setSettings(). | Overrides RulesEventHandlerInterface::setSettings | |
RulesEventHandlerBase::validate | public | function | Implements RulesEventHandlerInterface::validate(). | Overrides RulesEventHandlerInterface::validate | 1 |
RulesEventHandlerBase::__construct | public | function | Implements RulesEventHandlerInterface::__construct(). | Overrides RulesEventHandlerInterface::__construct | 1 |
RulesEventHandlerInterface::buildForm | public | function | Builds the event settings form. | 2 | |
RulesEventHandlerInterface::getDefaults | public | function | Returns an array of default settings. | 2 | |
RulesEventHandlerInterface::getEventNameSuffix | public | function | Returns the suffix to be added to the base event named based upon settings. | 2 | |
RulesEventHandlerInterface::summary | public | function | Returns a user-facing summary of the settings. | 2 |