class RulesConditionalIf in Conditional Rules 8
Same name and namespace in other branches
- 7 includes/rules_conditional.plugin.inc \RulesConditionalIf
The "if" clause.
Hierarchy
- class \RulesConditionalElement extends \RulesActionContainer implements \RulesActionInterface
- class \RulesConditionalPredicateElement
- class \RulesConditionalIf
- class \RulesConditionalPredicateElement
Expanded class hierarchy of RulesConditionalIf
1 string reference to 'RulesConditionalIf'
- rules_conditional_rules_plugin_info in ./
rules_conditional.rules.inc - Implements hook_rules_plugin_info().
File
- includes/
rules_conditional.plugin.inc, line 87 - Rules plugin implementation.
View source
class RulesConditionalIf extends RulesConditionalPredicateElement {
protected $itemName = 'if';
public function pluginLabel() {
$previous = $this
->getPreviousSibling();
if ($previous && $previous instanceof RulesConditionalIf) {
return t('(Else) If', array(), array(
'context' => 'conditional rules',
));
}
else {
return parent::pluginLabel();
}
}
/**
* Imports predicate.
*/
protected function importPredicate($export, $key = NULL) {
$plugin = strtoupper($this
->plugin());
$pluginInfo = $this
->pluginInfo();
$keys = !empty($pluginInfo['import keys']) ? $pluginInfo['import keys'] : array(
$plugin,
);
foreach ($keys as $key) {
if (isset($export[$key])) {
parent::importPredicate($export, $key);
break;
}
}
}
/**
* Exports predicate.
*/
protected function exportPredicate($key = NULL) {
if ($this
->getPreviousSibling()) {
$key = 'ELSE IF';
}
return parent::exportPredicate($key);
}
}