You are here

public function RulesConditionalPredicateUI::form in Conditional Rules 7

Same name and namespace in other branches
  1. 8 includes/rules_conditional.ui.inc \RulesConditionalPredicateUI::form()

Delegates the form to the predicate.

Overrides RulesContainerPluginUI::form

1 call to RulesConditionalPredicateUI::form()
RulesConditionalWhileUI::form in includes/rules_conditional.ui.inc
Delegates the form to the predicate.
1 method overrides RulesConditionalPredicateUI::form()
RulesConditionalWhileUI::form in includes/rules_conditional.ui.inc
Delegates the form to the predicate.

File

includes/rules_conditional.ui.inc, line 78
Plugin UI implementation.

Class

RulesConditionalPredicateUI
UI for configuring the predicate in a conditional branch.

Code

public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
  $baseCount = count(explode('/', RulesPluginUI::$basePath));
  $op = arg($baseCount + 2);
  if ($op == 'add') {

    // Redirect to extended path.
    $pathAddPredicate = RulesPluginUI::path($this->element
      ->root()->name, 'add-predicate', $this->element
      ->parentElement(), $this->element
      ->plugin());
    drupal_goto($pathAddPredicate);
  }
  if (isset($this->predicate)) {

    // Build form for predicate.
    $form_state['rules_element'] = $this->predicate;
    $this->predicate
      ->form($form, $form_state, $options);
    $heading = '<h4 class="rules-form-heading">';
    $heading .= t('Condition');
    $heading .= '</h4>';
    $form['parameter']['#prefix'] = $heading;
  }
}