You are here

function rules_forms_after_build in Rules 6

Add element IDs on the form if the setting is enabled. Add submit and validation callbacks to form, buttons, etc. to invoke corresponding events.

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

File

rules_forms/rules_forms.module, line 123
Rules forms module.

Code

function rules_forms_after_build($form, &$form_state) {
  if (!empty($_SESSION['rules_forms_element_ids'])) {
    rules_forms_add_element_id($form);
  }
  drupal_add_css(drupal_get_path('module', 'rules_forms') . '/rules_forms.css');
  if (!$form_state['submitted']) {
    return $form;
  }
  if (empty($form_state['submit_handlers'])) {
    $form['#submit'][] = 'rules_forms_event_submit';
  }
  else {
    $form_state['submit_handlers'][] = 'rules_forms_event_submit';
  }
  if (empty($form_state['validate_handlers'])) {
    $form['#validate'][] = 'rules_forms_event_validate';
  }
  else {
    $form_state['validate_handlers'][] = 'rules_forms_event_validate';
  }
  return $form;
}