/ Published in: PHP

Sets a module's weight to the lowest number. This assures that your module is ran before all other modules. Userfull if you want your implementation of a hook to be ran first.
Add this to your .install file. Replace your_modulename with the name of your module.
Add this to your .install file. Replace your_modulename with the name of your module.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function your_modulename_install() { switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': $weight = db_result(db_query('SELECT MIN(weight) AS weight FROM {system} WHERE status = 1')) - 1; db_query("UPDATE {system} SET weight = %d WHERE name = '%s'", $weight, 'your_modulename'); break; default: drupal_set_message(t('Your database type is not supported')); } }
Comments
