function taxonomy_defaults_requirements in Taxonomy Defaults 7
Same name and namespace in other branches
- 6.2 taxonomy_defaults.install \taxonomy_defaults_requirements()
- 6 taxonomy_defaults.install \taxonomy_defaults_requirements()
Implements hook_requirements().
File
- ./
taxonomy_defaults.install, line 48 - Install, update and uninstall functions for the taxonomy_defaults module.
Code
function taxonomy_defaults_requirements($phase) {
$requirements = array();
$tax_weight = 0;
$weight = 0;
$query = "SELECT weight FROM {system} WHERE type = 'module' AND status = 1 and name = 'taxonomy'";
$result = db_query("SELECT weight FROM {system} WHERE type = :type AND status = :status and name = :name", array(
':type' => 'module',
':status' => 1,
':name' => 'taxonomy',
));
if ($row = db_fetch_object($result)) {
$tax_weight = $row->weight;
}
$query = "SELECT weight FROM {system} WHERE type = 'module' AND status = 1 and name = 'taxonomy_defaults'";
$result = db_query("SELECT weight FROM {system} WHERE type = :type AND status = :status and name = :name", array(
':type' => 'module',
':status' => 1,
':name' => 'taxonomy_defaults',
));
if ($row = db_fetch_object($result)) {
$weight = $row->weight;
if ($tax_weight >= $weight) {
$requirements['taxdef'] = array(
'title' => t('Taxonomy Defaults'),
'value' => t('Invalid Module Weight'),
'severity' => REQUIREMENT_ERROR,
'description' => t("The Taxonomy Defaults module's weight is lower than the Taxonomy module's, so taxonomy default settings will be ignored. !link to learn more about module weights, or reinstall the Taxonomy Defaults module.", array(
'!link' => l('Go here', 'http://drupal.org/node/110238'),
)),
);
}
}
return $requirements;
}