You are here

function jammer_generic_form_alter in Jammer 6

Same name and namespace in other branches
  1. 7 jammer_generic.module \jammer_generic_form_alter()

Implementation of hook_form_alter().

File

./jammer_generic.module, line 145
Remove configured form elements from forms.

Code

function jammer_generic_form_alter(&$form, $form_state, $form_id) {
  if ($form['#id'] != '-jammer-generic-admin-settings') {
    $current_settings = variable_get('jammer_generic_elements', array());
    foreach ($current_settings as $key => $value) {
      if ($value['jammer_generic_form_id'] == $form_id) {
        $element_id = $value['jammer_generic_element_id'];

        // Crawl the form for this element to remove it.
        foreach (element_children($form) as $key) {
          $form[$key] = _jammer_generic_remove_element($form[$key], $key, $element_id);

          // Recursive.
        }
      }
    }
  }
}