You are here

function rules_forms_after_build in Rules Forms Support 7.2

Same name and namespace in other branches
  1. 7 rules_forms.module \rules_forms_after_build()

Builds property info about the form structure if necessary.

1 string reference to 'rules_forms_after_build'
rules_forms_form_alter in ./rules_forms.module
Implements hook_form_alter().

File

./rules_forms.module, line 229
Rules Forms Support provides events, conditions, and actions for site forms.

Code

function rules_forms_after_build($form, &$form_state) {
  $form_id = $form['form_id']['#value'];
  $form_info = rules_forms_get_form_info($form_id);
  if ($form_info !== FALSE && !empty($form_info['rebuild'])) {
    $evaluator = new RulesFormsFormEvaluator();
    $property_info = $evaluator
      ->evaluate($form);

    // Allow modules to alter the property info directly.
    drupal_alter('rules_forms_form_property_info', $property_info, $form, $form_id);
    $form_info['properties'] = $property_info['properties'];
    $form_info['rebuild'] = FALSE;
    rules_forms_update_form_info($form_info);
    rules_forms_clear_cache();
    drupal_set_message(t('Form elements for %form have been built.', array(
      '%form' => $form_info['label'],
    )));
  }

  // @TODO Consider adding the element inspection tool.
  return $form;
}