Gabor Hojtsy wrote:
- Check the database (or the module_list()) in the early callback.
- Check it again at the callback called last.
- Compute the difference.
- Import what needs to be imported
Is this clean and does it have some catch? It works for me
function autolocale_form_alter($form_id, &$form) { // Process only if module form is displayed if ($form_id === "system_modules") {
// Determine which modules are enabled at the moment if (is_array($form['status']['#default_value'])) { $autolocale_modules = array(); foreach ($form['status']['#default_value'] as $module) { array_push($autolocale_modules, $module); }
// We MUST skip module confirm form if ($_GET['q'] != "admin/build/modules/list/confirm") { $enabled = array_diff($autolocale_modules, $_SESSION['autolocale_modules']); if (!empty($enabled)) { // These modules have been enabled print_r($enabled); // TODO } }
// Store modules for next reload $_SESSION['autolocale_modules'] = $autolocale_modules; }
} }