You are here

function webform_localization_module_implements_alter in Webform Localization 7.4

Implements hook_module_implements_alter().

We need our hook_form_alter() to run before mollom's, so that we can prime and modify its cache before mollom uses it.

See also

webform_localization_form_alter()

mollom_form_alter()

File

./webform_localization.module, line 945
Webform localization module.

Code

function webform_localization_module_implements_alter(&$implementations, $hook) {
  if ($hook != 'form_alter') {
    return;
  }

  // If mollom isn't enabled, do nothing.
  if (!module_exists('mollom')) {
    return;
  }

  // If our code will run before mollom's, do nothing.
  $pos = array_flip(array_keys($implementations));
  if ($pos['webform_localization'] < $pos['mollom']) {
    return;
  }

  // Make it so our hook implementation runs before mollom's.
  $webform_localization = array(
    'webform_localization' => $implementations['webform_localization'],
  );
  $implementations = array_diff_key($implementations, $webform_localization);
  $implementations = array_merge(array_slice($implementations, 0, $pos['mollom'], TRUE), $webform_localization, array_slice($implementations, $pos['mollom'], NULL, TRUE));
}