You are here

function thunder_modules_uninstalled in Thunder 6.1.x

Same name and namespace in other branches
  1. 8.5 thunder.profile \thunder_modules_uninstalled()
  2. 8.2 thunder.profile \thunder_modules_uninstalled()
  3. 8.3 thunder.profile \thunder_modules_uninstalled()
  4. 8.4 thunder.profile \thunder_modules_uninstalled()
  5. 6.2.x thunder.profile \thunder_modules_uninstalled()
  6. 6.0.x thunder.profile \thunder_modules_uninstalled()

Implements hook_modules_uninstalled().

File

./thunder.profile, line 110
Enables modules and site configuration for a thunder site installation.

Code

function thunder_modules_uninstalled($modules) {

  // Import the content view if it was deleted during module uninstalling.
  // This could happen if content_lock was uninstalled and the content view
  // contained content_lock fields at that time.
  if (in_array('content_lock', $modules, TRUE)) {

    /** @var \Drupal\Core\Routing\RouteProviderInterface $route_provider */
    $route_provider = \Drupal::service('router.route_provider');
    $found_routes = $route_provider
      ->getRoutesByPattern('admin/content');
    $view_found = FALSE;
    foreach ($found_routes
      ->getIterator() as $route) {
      if (!empty($route
        ->getDefault('view_id'))) {
        $view_found = TRUE;
        break;
      }
    }
    if (!$view_found) {
      $config_service = \Drupal::service('config_update.config_update');
      $config_service
        ->import('view', 'content');
    }
  }
}