function eck_system_info_alter in Entity Construction Kit (ECK) 7.3
Same name and namespace in other branches
- 7.2 eck.module \eck_system_info_alter()
Implements hook_system_info_alter().
If there are entity types created, lets not let the user disable the module. If the eck_entity_cache module is installed, eck can not be disabled.
File
- ./
eck.module, line 1163
Code
function eck_system_info_alter(&$info, $file, $type) {
if ($type == "module" && array_key_exists("name", $info) && $info['name'] == "Entity Construction Kit") {
$done = FALSE;
$entity_types = EntityType::loadAll();
if (!empty($entity_types)) {
$info['required'] = TRUE;
$info['explanation'] = "Entity types created by ECK are still present in the system.";
$done = TRUE;
}
// If ECK EntityCache is installed, we can not disable or uninstall ECK.
if (!$done) {
$query = db_select("system", "s");
$query
->fields('s', array(
'schema_version',
));
$query
->condition('s.name', 'eck_entitycache', '=');
$query
->condition('s.type', 'module', '=');
$result = $query
->execute();
foreach ($result as $row) {
$schema_version = $row->schema_version;
if ($schema_version == 0) {
$info['required'] = TRUE;
$info['explanation'] = "ECK EntityCache must be uninstalled before you can disable/uninstall ECK";
}
}
}
}
}