You are here

function social_content_modules_uninstalled in Social Content 7.2

Implements hook_modules_uninstalled().

File

./social_content.module, line 273
Social Content module.

Code

function social_content_modules_uninstalled($modules) {
  foreach ($modules as $module) {
    require_once DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . '/' . $module . '.module';
    $function = $module . '_social_content_class_info';

    // If this module implements hook_social_content_class_info(), we should
    // remove all instances and history.
    if (function_exists($function)) {
      module_load_include('inc', $module, $module . '.class');
      $info = $function();
      $name = key($info);
      $instances = SocialContent::getAllInstances($name);
      foreach ($instances as $i) {
        $instance = new $info[$name]($i->settings);
        $instance
          ->deleteInstance();
      }
    }
  }
}