function tca_modules_uninstalled in Token Content Access 7
Implements hook_modules_uninstalled().
File
- ./
tca.module, line 81 - The Token Content Access module file.
Code
function tca_modules_uninstalled($modules) {
foreach ($modules as $module) {
// If this module implements hook_tca(), we should remove the Token Content
// Access fields from the base table of the entity type that this module is
// altering. We need to include the .module file manually, since the module
// hsa been uninstalled and therefore, isn't reachable the normal way.
require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . '/' . $module . '.module';
$function = $module . '_tca';
if (function_exists($function)) {
// Gather info about the module, entity and get the Token Content Access
// fields.
$tca_info = $function();
$entity_info = entity_get_info($tca_info[$module]['entity type']);
$fields = tca_schema_fields();
// Remove each field from the base table for the entity.
foreach ($fields as $name => $spec) {
if (db_field_exists($entity_info['base table'], $name)) {
db_drop_field($entity_info['base table'], $name);
}
}
// Delete any variables that are set for this entity.
foreach ($entity_info['bundles'] as $bundle => $info) {
tca_delete_variables($tca_info[$module]['entity type'], $bundle);
}
}
}
}