You are here

function om_tools_alter in OM Tools 7.2

Same name and namespace in other branches
  1. 8.2 inc/om_tools.utils.inc \om_tools_alter()

OM Tools alter forms processor

1 call to om_tools_alter()
om_tools_form_alter in ./om_tools.module
Implementation of hook_form_alter().

File

inc/om_tools.utils.inc, line 18
OM Tools Admin Utilities

Code

function om_tools_alter(&$form, &$form_state, $form_id) {
  $om_tools_values = variable_get('om_tools', '');
  $tools = om_tools_get();
  foreach ($tools as $key => $module) {
    if (isset($om_tools_values[$module])) {
      $form['om_' . $module . '_tools_values']['#type'] = 'hidden';
      $form['om_' . $module . '_tools_values']['#value'] = isset($om_tools_values[$module]) ? $om_tools_values[$module] : '';
      include_once drupal_get_path('module', 'om_tools') . '/tools/' . $module . '/' . $module . '.inc';
      $function = 'om_' . $module . '_alter';
      if (function_exists($function)) {
        $function($form, $form_state, $form_id);
      }

      // this avoids inclusion in the actual output of form
      unset($form['om_' . $module . '_tools_values']);
    }
  }
}