updated rules
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file Contains UI for diverse plugins provided by Rules.
|
||||
* @file
|
||||
* Contains UI for diverse plugins provided by Rules.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -9,15 +10,21 @@
|
||||
*/
|
||||
class RulesRuleUI extends RulesActionContainerUI {
|
||||
|
||||
protected $rule, $conditions;
|
||||
protected $rule;
|
||||
protected $conditions;
|
||||
|
||||
/**
|
||||
* Constructs a RulesRuleUI object.
|
||||
*
|
||||
* @param FacesExtendable $object
|
||||
*/
|
||||
public function __construct(FacesExtendable $object) {
|
||||
parent::__construct($object);
|
||||
$this->rule = $object;
|
||||
$this->conditions = $this->rule->conditionContainer();
|
||||
}
|
||||
|
||||
public function form(&$form, &$form_state, $options = array()) {
|
||||
public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
|
||||
$form_state['rules_element'] = $this->rule;
|
||||
$label = $this->element->label();
|
||||
// Automatically add a counter to unlabelled rules.
|
||||
@@ -58,7 +65,7 @@ class RulesRuleUI extends RulesActionContainerUI {
|
||||
/**
|
||||
* Applies the values of the form to the rule configuration.
|
||||
*/
|
||||
function form_extract_values($form, &$form_state) {
|
||||
public function form_extract_values($form, &$form_state) {
|
||||
$form_values = RulesPluginUI::getFormStateValues($form, $form_state);
|
||||
// Run condition and action container value extraction.
|
||||
if (isset($form['conditions'])) {
|
||||
@@ -70,13 +77,13 @@ class RulesRuleUI extends RulesActionContainerUI {
|
||||
parent::form_extract_values($form, $form_state);
|
||||
}
|
||||
|
||||
|
||||
public function operations() {
|
||||
// When rules are listed only show the edit and delete operations.
|
||||
$ops = parent::operations();
|
||||
$ops['#links'] = array_intersect_key($ops['#links'], array_flip(array('edit', 'delete')));
|
||||
return $ops;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +91,7 @@ class RulesRuleUI extends RulesActionContainerUI {
|
||||
*/
|
||||
class RulesReactionRuleUI extends RulesRuleUI {
|
||||
|
||||
public function form(&$form, &$form_state, $options = array()) {
|
||||
public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
|
||||
$form['events'] = array(
|
||||
'#type' => 'container',
|
||||
'#weight' => -10,
|
||||
@@ -94,7 +101,7 @@ class RulesReactionRuleUI extends RulesRuleUI {
|
||||
$form['events']['table'] = array(
|
||||
'#theme' => 'table',
|
||||
'#caption' => 'Events',
|
||||
'#header' => array('Event', 'Operations'),
|
||||
'#header' => array(t('Event'), t('Operations')),
|
||||
'#empty' => t('None'),
|
||||
);
|
||||
$form['events']['table']['#attributes']['class'][] = 'rules-elements-table';
|
||||
@@ -170,6 +177,7 @@ class RulesReactionRuleUI extends RulesRuleUI {
|
||||
$this->rule->active = $form_values['active'];
|
||||
$this->rule->weight = $form_values['weight'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,6 +194,7 @@ class RulesRuleSetUI extends RulesActionContainerUI {
|
||||
$form['elements']['#attributes']['class'][] = 'rules-rule-set';
|
||||
$form['elements']['#caption'] = t('Rules');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,7 +202,7 @@ class RulesRuleSetUI extends RulesActionContainerUI {
|
||||
*/
|
||||
class RulesLoopUI extends RulesActionContainerUI {
|
||||
|
||||
public function form(&$form, &$form_state, $options = array()) {
|
||||
public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
|
||||
parent::form($form, $form_state, $options);
|
||||
$settings = $this->element->settings;
|
||||
|
||||
@@ -219,7 +228,7 @@ class RulesLoopUI extends RulesActionContainerUI {
|
||||
);
|
||||
}
|
||||
|
||||
function form_extract_values($form, &$form_state) {
|
||||
public function form_extract_values($form, &$form_state) {
|
||||
parent::form_extract_values($form, $form_state);
|
||||
$form_values = RulesPluginUI::getFormStateValues($form, $form_state);
|
||||
|
||||
@@ -251,4 +260,5 @@ class RulesLoopUI extends RulesActionContainerUI {
|
||||
);
|
||||
return $content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user