function hierarchical_select_install in Hierarchical Select 5.3
Same name and namespace in other branches
- 5.2 hierarchical_select.install \hierarchical_select_install()
- 6.3 hierarchical_select.install \hierarchical_select_install()
Implementation of hook_install().
File
- ./
hierarchical_select.install, line 12 - Install file for the Hierarchical Select module.
Code
function hierarchical_select_install() {
// Ensure the Hierarchical Select module runs after the Taxonomy and Content
// Taxonomy modules! This should not be necessary to do, but apparently some
// idiot module developer is changing the weight of the Taxonomy module...
$weight = db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"));
$weight = max($weight, db_result(db_query("SELECT weight FROM {system} WHERE name = 'content_taxonomy'")));
// Also ensure the Hierarchical Select module runs after the i18ntaxonomy
// module.
$weight = max($weight, db_result(db_query("SELECT weight FROM {system} WHERE name = 'i18ntaxonomy'")));
// Also ensure the Hierarchical Select module runs after the og_vocab module.
$weight = max($weight, db_result(db_query("SELECT weight FROM {system} WHERE name = 'og_vocab'")));
// If none of these modules was already enabled, the weight will still be
// incorrect. Therefore, let's make the minimum weight of Hierarchical
// Select 15.
$weight = max($weight, 15);
// Set the weight one higher than the highest weight we've encountered, so
// that Hierarchical Select will run after it.
$weight++;
db_query("UPDATE {system} SET weight = %d WHERE name = '%s'", $weight, 'hierarchical_select');
}