You are here

public function RulesConditionalWhileUI::form in Conditional Rules 8

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

Delegates the form to the predicate.

Overrides RulesConditionalPredicateUI::form

File

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

Class

RulesConditionalWhileUI
UI for while loops to add extra description.

Code

public function form(&$form, &$form_state, $options = array(), $iterator = NULL) {
  parent::form($form, $form_state, $options);

  // Display help for while loop.
  $form['while_help'] = array(
    '#weight' => -5,
  );
  $form['while_help']['text'] = array(
    '#prefix' => '<p>',
    '#markup' => t('Configure the condition for this while loop to continue. This loop will not end until the condition evaluates to false, or the maximum limit on the number of iterations has been reached.'),
    '#suffix' => '</p>',
  );

  // Display help to change iteration limit.
  $maxIterations = variable_get('rules_conditional_max_iterations', RULES_CONDITIONAL_MAX_ITERATIONS);
  $form['while_help']['description'] = array(
    '#prefix' => '<div class="description"><p>',
    '#markup' => t('The current limit is @limit. Note that this cannot be changed in the user interface. Although it can be changed by setting the %variable variable to another value, raising this limit must be done with care since Rules evaluation can be resource-intensive.', array(
      '@limit' => $maxIterations,
      '%variable' => 'rules_conditional_max_iterations',
    )),
    '#suffix' => '</p></div>',
  );
}