function rules_forms_after_build in Rules Forms Support 7
Same name and namespace in other branches
- 7.2 rules_forms.module \rules_forms_after_build()
Add element IDs on the form if the setting is enabled.
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 257 - 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);
// Set elements for form events if necessary.
// Ensure that the form ID matches an activated form's form ID to prevent
// improper Rules events from being loaded in hook_rules_event_info().
if (isset($form_info) && $form_info !== FALSE && (isset($form_info['reset']) && $form_info['reset'] || (!isset($form_info['elements']) || empty($form_info['elements'])))) {
if (!empty($form_info['reset'])) {
$form_info['reset'] = FALSE;
}
$form_info['elements'] = array();
$form_info['validate'] = array();
$form_info['submit'] = array();
rules_forms_build_elements($form, $form_info);
rules_forms_save_form_info($form_id, $form_info);
drupal_set_message(t('Form elements for %form have been built.', array(
'%form' => $form_info['label'],
)));
}
// Add element information for reference by users.
if (!empty($_SESSION['rules_forms_element_info'])) {
rules_forms_add_popups($form, $form_info['elements']);
drupal_add_css(drupal_get_path('module', 'rules_forms') . '/rules_forms.css');
}
return $form;
}