public function RuleConditionSetUI::form in Conditional Rules 8
Same name and namespace in other branches
- 7 includes/rules_conditional.ui.inc \RuleConditionSetUI::form()
File
- includes/
rules_conditional.ui.inc, line 240 - Plugin UI implementation.
Class
- RuleConditionSetUI
- UI for rule condition set.
Code
public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
$form_state['rules_element'] = $this->set;
$form += array(
'actions' => array(
'#weight' => -5,
'#tree' => TRUE,
),
);
$this->actions
->form($form['actions'], $form_state);
// Add condition result form.
$iterator = new RecursiveIteratorIterator($this->set
->conditions(), RecursiveIteratorIterator::SELF_FIRST);
parent::form($form, $form_state, $options, $iterator);
$form['elements']['#caption'] = t('Result conditions');
$form['negate']['#weight'] = 1;
// Hide nested elements during creation.
$form['elements']['#access'] = empty($options['init']);
$form['actions']['elements']['#access'] = empty($options['init']);
$form['help']['#markup'] = t('A rule condition set evaluates the actions first. Variables provided by the actions then can be used to evaluate the result conditions (as an "AND", i.e. evaluating to TRUE if conditions are empty).');
$form['help']['#weight'] = -5;
$form_state['redirect'] = RulesPluginUI::path($this->element
->root()->name);
if (!empty($options['button'])) {
$form['submit']['#value'] = t('Save changes');
}
}