예제 #1
0
/**
 * Implements hook_form_system_theme_settings_alter() function.
 *
 * @param $form
 *   Nested array of form elements that comprise the form.
 * @param $form_state
 *   A keyed array containing the current state of the form.
 */
function rubik_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL)
{
    // Work-around for a core bug affecting admin themes. See issue #943212.
    if (isset($form_id)) {
        return;
    }
    $form['rubik'] = array('#type' => 'fieldset', '#title' => t('Rubik'));
    $form['rubik']['rubik_show_branding'] = array('#type' => 'checkbox', '#title' => t('Show branding'), '#description' => t('Display the "branding" line at the top of the page with breadcrumbs and secondary menu.'), '#default_value' => theme_get_setting('rubik_show_branding', 'rubik'));
    $form['rubik']['rubik_inline_field_descriptions'] = array('#type' => 'checkbox', '#title' => t('Display form field descriptions inline.'), '#description' => t("By default, each field's description is displayed in a pop-up, which is only visible when hovering over that field. Select this option to make all field descriptions visible at all times."), '#default_value' => theme_get_setting('rubik_inline_field_descriptions', 'rubik'));
    $form['rubik']['rubik_disable_sticky_sidebar'] = array('#type' => 'checkbox', '#title' => t('Disable sticky sidebar'), '#description' => t("By default, the sidebar will fix itself when scrolling down a form. If you have a lot of fields in the sidebar, consider disabling the sticky sidebar to view them all."), '#default_value' => theme_get_setting('rubik_disable_sticky_sidebar', 'rubik'));
    $form['rubik']['rubik_disable_sidebar_in_form'] = array('#type' => 'checkbox', '#title' => t('Disable sidebar in forms'), '#description' => t("By default, the sidebar is enabled for forms."), '#default_value' => theme_get_setting('rubik_disable_sidebar_in_form', 'rubik'));
    $form['rubik']['rubik_sidebar_field_ui'] = array('#type' => 'checkbox', '#title' => t('Display fields in the sidebar of the node edit form.'), '#description' => t("By default, each field is displayed in the main content area of the node edit form. This option allows you to move fields into the sidebar to improve user experience."), '#default_value' => theme_get_setting('rubik_sidebar_field_ui', 'rubik'), '#states' => array('invisible' => array(':input[name="rubik_disable_sidebar_in_form"]' => array('checked' => TRUE))));
    // If the sidebar is disabled, we need to disable the sidebar field ui as well.
    $rubik_disable_sidebar_in_form = theme_get_setting('rubik_disable_sidebar_in_form', 'rubik');
    if ($rubik_disable_sidebar_in_form == 1) {
        $form['rubik']['rubik_sidebar_field_ui']['#default_value'] = 0;
    }
    // Rebuild theme registry on form save.
    if (!empty($form_state)) {
        // Rebuild .info data.
        system_rebuild_theme_data();
        // Rebuild theme registry.
        drupal_theme_rebuild();
    }
}
 function edit_form_submit(&$form, &$form_state)
 {
     parent::edit_form_submit($form, $form_state);
     // Ensure that the Stack layout theme exists in the theme registry,
     // otherwise, rebuild it.
     $theme_hooks = theme_get_registry();
     if (!isset($theme_hooks['panels_frame_stack'])) {
         drupal_theme_rebuild();
     }
 }
예제 #3
0
 /**
  * Initializes devel module requirements.
  */
 public function onRequest(GetResponseEvent $event)
 {
     if ($this->account->hasPermission('access devel information')) {
         devel_set_handler(devel_get_handlers());
         // We want to include the class early so that anyone may call krumo()
         // as needed. See http://krumo.sourceforge.net/
         has_krumo();
         // See http://www.firephp.org/HQ/Install.htm
         $path = NULL;
         if (@(include_once 'fb.php') || @(include_once 'FirePHPCore/fb.php')) {
             // FirePHPCore is in include_path. Probably a PEAR installation.
             $path = '';
         } elseif ($this->moduleHandler->moduleExists('libraries')) {
             // Support Libraries API - http://drupal.org/project/libraries
             $firephp_path = libraries_get_path('FirePHPCore');
             $firephp_path = $firephp_path ? $firephp_path . '/lib/FirePHPCore/' : '';
             $chromephp_path = libraries_get_path('chromephp');
         } else {
             $firephp_path = DRUPAL_ROOT . '/libraries/FirePHPCore/lib/FirePHPCore/';
             $chromephp_path = './' . drupal_get_path('module', 'devel') . '/chromephp';
         }
         // Include FirePHP if it exists.
         if (!empty($firephp_path) && file_exists($firephp_path . 'fb.php')) {
             include_once $firephp_path . 'fb.php';
             include_once $firephp_path . 'FirePHP.class.php';
         }
         // Include ChromePHP if it exists.
         if (!empty($chromephp_path) && file_exists($chromephp_path .= '/ChromePhp.php')) {
             include_once $chromephp_path;
         }
     }
     if ($this->config->get('rebuild_theme')) {
         drupal_theme_rebuild();
         // Ensure that the active theme object is cleared.
         $theme_name = \Drupal::theme()->getActiveTheme()->getName();
         \Drupal::state()->delete('theme.active_theme.' . $theme_name);
         \Drupal::theme()->resetActiveTheme();
         /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler*/
         $theme_handler = \Drupal::service('theme_handler');
         $theme_handler->refreshInfo();
         // @todo This is not needed after https://www.drupal.org/node/2330755
         $list = $theme_handler->listInfo();
         $theme_handler->addTheme($list[$theme_name]);
         if (\Drupal::service('flood')->isAllowed('devel.rebuild_theme_warning', 1)) {
             \Drupal::service('flood')->register('devel.rebuild_theme_warning');
             if ($this->account->hasPermission('access devel information')) {
                 drupal_set_message(t('The theme information is being rebuilt on every request. Remember to <a href=":url">turn off</a> this feature on production websites.', array(':url' => $this->urlGenerator->generateFromRoute('devel.admin_settings'))));
             }
         }
     }
 }
예제 #4
0
 /**
  * Generates themed output early in a page request.
  *
  * @see \Drupal\system\Tests\Theme\ThemeEarlyInitializationTest::testRequestListener()
  */
 public function onRequest(GetResponseEvent $event)
 {
     if ($this->currentRouteMatch->getRouteName() === 'theme_test.request_listener') {
         // First, force the theme registry to be rebuilt on this page request.
         // This allows us to test a full initialization of the theme system in
         // the code below.
         drupal_theme_rebuild();
         // Next, initialize the theme system by storing themed text in a global
         // variable. We will use this later in
         // theme_test_request_listener_page_callback() to test that even when the
         // theme system is initialized this early, it is still capable of
         // returning output and theming the page as a whole.
         $more_link = array('#type' => 'more_link', '#url' => Url::fromRoute('user.page'), '#attributes' => array('title' => 'Themed output generated in a KernelEvents::REQUEST listener'));
         $GLOBALS['theme_test_output'] = $this->renderer->renderPlain($more_link);
     }
 }
예제 #5
0
 /**
  * Generates themed output early in a page request.
  *
  * @see \Drupal\system\Tests\Theme\ThemeEarlyInitializationTest::testRequestListener()
  */
 public function onRequest(GetResponseEvent $event)
 {
     $request = $event->getRequest();
     $current_path = $request->attributes->get('_system_path');
     if ($current_path == 'theme-test/request-listener') {
         // First, force the theme registry to be rebuilt on this page request.
         // This allows us to test a full initialization of the theme system in
         // the code below.
         drupal_theme_rebuild();
         // Next, initialize the theme system by storing themed text in a global
         // variable. We will use this later in
         // theme_test_request_listener_page_callback() to test that even when the
         // theme system is initialized this early, it is still capable of
         // returning output and theming the page as a whole.
         $more_link = array('#theme' => 'more_link', '#url' => 'user', '#title' => 'Themed output generated in a KernelEvents::REQUEST listener');
         $GLOBALS['theme_test_output'] = drupal_render($more_link);
     }
 }
 /**
  * Initializes devel module requirements.
  */
 public function onRequest(GetResponseEvent $event)
 {
     if ($this->config->get('rebuild_theme')) {
         drupal_theme_rebuild();
         // Ensure that the active theme object is cleared.
         $theme_name = \Drupal::theme()->getActiveTheme()->getName();
         \Drupal::state()->delete('theme.active_theme.' . $theme_name);
         \Drupal::theme()->resetActiveTheme();
         /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler*/
         $theme_handler = \Drupal::service('theme_handler');
         $theme_handler->refreshInfo();
         // @todo This is not needed after https://www.drupal.org/node/2330755
         $list = $theme_handler->listInfo();
         $theme_handler->addTheme($list[$theme_name]);
         if (\Drupal::service('flood')->isAllowed('devel.rebuild_theme_warning', 1)) {
             \Drupal::service('flood')->register('devel.rebuild_theme_warning');
             if ($this->account->hasPermission('access devel information')) {
                 drupal_set_message(t('The theme information is being rebuilt on every request. Remember to <a href=":url">turn off</a> this feature on production websites.', array(':url' => $this->urlGenerator->generateFromRoute('devel.admin_settings'))));
             }
         }
     }
 }
예제 #7
0
require_once $theme_path . '/includes/form.inc';
require_once $theme_path . '/includes/admin.inc';
require_once $theme_path . '/includes/menu.inc';
// Load module specific files in the modules directory.
$includes = file_scan_directory($theme_path . '/includes/modules', '/\\.inc$/');
foreach ($includes as $include) {
    if (module_exists($include->name)) {
        require_once $include->uri;
    }
}
// Auto-rebuild the theme registry during theme development.
if (theme_get_setting('bootstrap_rebuild_registry') && !defined('MAINTENANCE_MODE')) {
    // Rebuild .info data.
    system_rebuild_theme_data();
    // Rebuild theme registry.
    drupal_theme_rebuild();
}
/**
 * hook_theme() 
 */
function bootstrap_theme(&$existing, $type, $theme, $path)
{
    // If we are auto-rebuilding the theme registry, warn about the feature.
    if (function_exists('user_access') && user_access('administer site configuration') && theme_get_setting('bootstrap_rebuild_registry') && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) {
        flood_register_event($GLOBALS['theme'] . '_rebuild_registry_warning');
        drupal_set_message(t('For easier theme development, the theme registry is being rebuilt on every page request. It is <em>extremely</em> important to <a href="!link">turn off this feature</a> on production websites.', array('!link' => url('admin/appearance/settings/' . $GLOBALS['theme']))), 'warning', FALSE);
    }
    return array('bootstrap_links' => array('variables' => array('links' => array(), 'attributes' => array(), 'heading' => NULL)), 'bootstrap_btn_dropdown' => array('variables' => array('links' => array(), 'attributes' => array(), 'type' => NULL)));
}
/**
 * Override theme_breadrumb().
예제 #8
0
/**
 * Form submit handler for the theme settings form.
 */
function omega_theme_settings_form_submit($form, &$form_state)
{
    // Clear the theme cache.
    $theme = $form_state['build_info']['args'][0];
    cache_clear_all('omega:' . $theme . ':', 'cache', TRUE);
    // We also need to clear the static right away.
    drupal_static_reset('omega_extensions');
    // Rebuild the theme registry. This has quite a performance impact but since
    // this only happens once after we (re-)saved the theme settings this is fine.
    // Also, this is actually required because we are caching certain things in
    // the theme registry.
    drupal_theme_rebuild();
    // We really don't want to reset theme settings for disabled extensions.
    foreach ($form_state['extensions'] as $extension) {
        if (!$form_state['values']['omega_toggle_extension_' . $extension]) {
            _omega_retain_extension_settings($form, $form_state, $extension, $theme);
        }
    }
    // This is a relict from the vertical tabs and should be removed so it doesn't
    // end up in the theme settings array.
    unset($form_state['values']['omega__active_tab']);
}
 /**
  * {@inheritdoc}
  */
 public function uninstall(array $module_list, $uninstall_dependents = TRUE)
 {
     // Get all module data so we can find dependencies and sort.
     $module_data = system_rebuild_module_data();
     $module_list = $module_list ? array_combine($module_list, $module_list) : array();
     if (array_diff_key($module_list, $module_data)) {
         // One or more of the given modules doesn't exist.
         return FALSE;
     }
     // Only process currently installed modules.
     $extension_config = \Drupal::config('core.extension');
     $installed_modules = $extension_config->get('module') ?: array();
     if (!($module_list = array_intersect_key($module_list, $installed_modules))) {
         // Nothing to do. All modules already uninstalled.
         return TRUE;
     }
     if ($uninstall_dependents) {
         // Add dependent modules to the list. The new modules will be processed as
         // the while loop continues.
         $profile = drupal_get_profile();
         while (list($module) = each($module_list)) {
             foreach (array_keys($module_data[$module]->required_by) as $dependent) {
                 if (!isset($module_data[$dependent])) {
                     // The dependent module does not exist.
                     return FALSE;
                 }
                 // Skip already uninstalled modules.
                 if (isset($installed_modules[$dependent]) && !isset($module_list[$dependent]) && $dependent != $profile) {
                     $module_list[$dependent] = $dependent;
                 }
             }
         }
     }
     // Set the actual module weights.
     $module_list = array_map(function ($module) use($module_data) {
         return $module_data[$module]->sort;
     }, $module_list);
     // Sort the module list by their weights.
     asort($module_list);
     $module_list = array_keys($module_list);
     // Only process modules that are enabled. A module is only enabled if it is
     // configured as enabled. Custom or overridden module handlers might contain
     // the module already, which means that it might be loaded, but not
     // necessarily installed.
     $schema_store = \Drupal::keyValue('system.schema');
     $entity_manager = \Drupal::entityManager();
     foreach ($module_list as $module) {
         // Clean up all entity bundles (including fields) of every entity type
         // provided by the module that is being uninstalled.
         foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
             if ($entity_type->getProvider() == $module) {
                 foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) {
                     $entity_manager->onBundleDelete($bundle, $entity_type_id);
                 }
             }
         }
         // Allow modules to react prior to the uninstallation of a module.
         $this->invokeAll('module_preuninstall', array($module));
         // Uninstall the module.
         module_load_install($module);
         $this->invoke($module, 'uninstall');
         // Remove all configuration belonging to the module.
         \Drupal::service('config.manager')->uninstall('module', $module);
         // Notify the entity manager that this module's entity types are being
         // deleted, so that it can notify all interested handlers. For example,
         // a SQL-based storage handler can use this as an opportunity to drop
         // the corresponding database tables.
         foreach ($entity_manager->getDefinitions() as $entity_type) {
             if ($entity_type->getProvider() == $module) {
                 $entity_manager->onEntityTypeDelete($entity_type);
             }
         }
         // Remove the schema.
         drupal_uninstall_schema($module);
         // Remove the module's entry from the config.
         $extension_config->clear("module.{$module}")->save();
         // Update the module handler to remove the module.
         // The current ModuleHandler instance is obsolete with the kernel rebuild
         // below.
         $module_filenames = $this->getModuleList();
         unset($module_filenames[$module]);
         $this->setModuleList($module_filenames);
         // Remove any potential cache bins provided by the module.
         $this->removeCacheBins($module);
         // Clear the static cache of system_rebuild_module_data() to pick up the
         // new module, since it merges the installation status of modules into
         // its statically cached list.
         drupal_static_reset('system_rebuild_module_data');
         // Clear plugin manager caches and flag router to rebuild if requested.
         \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
         \Drupal::service('router.builder_indicator')->setRebuildNeeded();
         // Update the kernel to exclude the uninstalled modules.
         \Drupal::service('kernel')->updateModules($module_filenames, $module_filenames);
         // Update the theme registry to remove the newly uninstalled module.
         drupal_theme_rebuild();
         // Modules can alter theme info, so refresh theme data.
         // @todo ThemeHandler cannot be injected into ModuleHandler, since that
         //   causes a circular service dependency.
         // @see https://drupal.org/node/2208429
         \Drupal::service('theme_handler')->refreshInfo();
         \Drupal::logger('system')->info('%module module uninstalled.', array('%module' => $module));
         $schema_store->delete($module);
     }
     drupal_get_installed_schema_version(NULL, TRUE);
     // Let other modules react.
     $this->invokeAll('modules_uninstalled', array($module_list));
     return TRUE;
 }
예제 #10
0
 /**
  * {@inheritdoc}
  */
 public function flush($path = NULL)
 {
     // A specific image path has been provided. Flush only that derivative.
     if (isset($path)) {
         $derivative_uri = $this->buildUri($path);
         if (file_exists($derivative_uri)) {
             file_unmanaged_delete($derivative_uri);
         }
         return $this;
     }
     // Delete the style directory in each registered wrapper.
     $wrappers = \Drupal::service('stream_wrapper_manager')->getWrappers(StreamWrapperInterface::WRITE_VISIBLE);
     foreach ($wrappers as $wrapper => $wrapper_data) {
         if (file_exists($directory = $wrapper . '://styles/' . $this->id())) {
             file_unmanaged_delete_recursive($directory);
         }
     }
     // Let other modules update as necessary on flush.
     $module_handler = \Drupal::moduleHandler();
     $module_handler->invokeAll('image_style_flush', array($this));
     // Clear caches so that formatters may be added for this style.
     drupal_theme_rebuild();
     Cache::invalidateTags($this->getCacheTagsToInvalidate());
     return $this;
 }
예제 #11
0
 /**
  * Ensures preprocess functions run even for suggestion implementations.
  *
  * The theme hook used by this test has its base preprocess function in a
  * separate file, so this test also ensures that that file is correctly loaded
  * when needed.
  */
 function testPreprocessForSuggestions()
 {
     // Test with both an unprimed and primed theme registry.
     drupal_theme_rebuild();
     for ($i = 0; $i < 2; $i++) {
         $this->drupalGet('theme-test/suggestion');
         $this->assertText('Theme hook implementor=test_theme_theme_test__suggestion(). Foo=template_preprocess_theme_test', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.');
     }
 }
예제 #12
0
 /**
  * Wraps drupal_theme_rebuild().
  */
 protected function themeRegistryRebuild()
 {
     drupal_theme_rebuild();
 }
예제 #13
0
 /**
  * Ensures suggestion preprocess functions run for default implementations.
  *
  * The theme hook used by this test has its base preprocess function in a
  * separate file, so this test also ensures that that file is correctly loaded
  * when needed.
  */
 public function testSuggestionPreprocessForDefaults()
 {
     \Drupal::service('theme_handler')->setDefault('test_theme');
     // Test with both an unprimed and primed theme registry.
     drupal_theme_rebuild();
     for ($i = 0; $i < 2; $i++) {
         $this->drupalGet('theme-test/preprocess-suggestions');
         $items = $this->cssSelect('.suggestion');
         $expected_values = ['Suggestion', 'Kitten', 'Monkey', 'Kitten', 'Flamingo'];
         foreach ($expected_values as $key => $value) {
             $this->assertEqual((string) $value, $items[$key]);
         }
     }
 }
예제 #14
0
 /**
  * {@inheritdoc}
  */
 public function uninstall(array $module_list, $uninstall_dependents = TRUE)
 {
     // Get all module data so we can find dependencies and sort.
     $module_data = system_rebuild_module_data();
     $module_list = $module_list ? array_combine($module_list, $module_list) : array();
     if (array_diff_key($module_list, $module_data)) {
         // One or more of the given modules doesn't exist.
         return FALSE;
     }
     $extension_config = \Drupal::configFactory()->getEditable('core.extension');
     $installed_modules = $extension_config->get('module') ?: array();
     if (!($module_list = array_intersect_key($module_list, $installed_modules))) {
         // Nothing to do. All modules already uninstalled.
         return TRUE;
     }
     if ($uninstall_dependents) {
         // Add dependent modules to the list. The new modules will be processed as
         // the while loop continues.
         $profile = drupal_get_profile();
         while (list($module) = each($module_list)) {
             foreach (array_keys($module_data[$module]->required_by) as $dependent) {
                 if (!isset($module_data[$dependent])) {
                     // The dependent module does not exist.
                     return FALSE;
                 }
                 // Skip already uninstalled modules.
                 if (isset($installed_modules[$dependent]) && !isset($module_list[$dependent]) && $dependent != $profile) {
                     $module_list[$dependent] = $dependent;
                 }
             }
         }
     }
     // Use the validators and throw an exception with the reasons.
     if ($reasons = $this->validateUninstall($module_list)) {
         foreach ($reasons as $reason) {
             $reason_message[] = implode(', ', $reason);
         }
         throw new ModuleUninstallValidatorException('The following reasons prevent the modules from being uninstalled: ' . implode('; ', $reason_message));
     }
     // Set the actual module weights.
     $module_list = array_map(function ($module) use($module_data) {
         return $module_data[$module]->sort;
     }, $module_list);
     // Sort the module list by their weights.
     asort($module_list);
     $module_list = array_keys($module_list);
     // Only process modules that are enabled. A module is only enabled if it is
     // configured as enabled. Custom or overridden module handlers might contain
     // the module already, which means that it might be loaded, but not
     // necessarily installed.
     foreach ($module_list as $module) {
         // Clean up all entity bundles (including fields) of every entity type
         // provided by the module that is being uninstalled.
         // @todo Clean this up in https://www.drupal.org/node/2350111.
         $entity_manager = \Drupal::entityManager();
         foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) {
             if ($entity_type->getProvider() == $module) {
                 foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) {
                     $entity_manager->onBundleDelete($bundle, $entity_type_id);
                 }
             }
         }
         // Allow modules to react prior to the uninstallation of a module.
         $this->moduleHandler->invokeAll('module_preuninstall', array($module));
         // Uninstall the module.
         module_load_install($module);
         $this->moduleHandler->invoke($module, 'uninstall');
         // Remove all configuration belonging to the module.
         \Drupal::service('config.manager')->uninstall('module', $module);
         // In order to make uninstalling transactional if anything uses routes.
         \Drupal::getContainer()->set('router.route_provider.old', \Drupal::service('router.route_provider'));
         \Drupal::getContainer()->set('router.route_provider', \Drupal::service('router.route_provider.lazy_builder'));
         // Notify interested components that this module's entity types are being
         // deleted. For example, a SQL-based storage handler can use this as an
         // opportunity to drop the corresponding database tables.
         // @todo Clean this up in https://www.drupal.org/node/2350111.
         $update_manager = \Drupal::entityDefinitionUpdateManager();
         foreach ($entity_manager->getDefinitions() as $entity_type) {
             if ($entity_type->getProvider() == $module) {
                 $update_manager->uninstallEntityType($entity_type);
             } elseif ($entity_type->isSubclassOf(FieldableEntityInterface::CLASS)) {
                 // The module being installed may be adding new fields to existing
                 // entity types. Field definitions for any entity type defined by
                 // the module are handled in the if branch.
                 $entity_type_id = $entity_type->id();
                 /** @var \Drupal\Core\Entity\FieldableEntityStorageInterface $storage */
                 $storage = $entity_manager->getStorage($entity_type_id);
                 foreach ($entity_manager->getFieldStorageDefinitions($entity_type_id) as $storage_definition) {
                     // @todo We need to trigger field purging here.
                     //   See https://www.drupal.org/node/2282119.
                     if ($storage_definition->getProvider() == $module && !$storage->countFieldData($storage_definition, TRUE)) {
                         $update_manager->uninstallFieldStorageDefinition($storage_definition);
                     }
                 }
             }
         }
         // Remove the schema.
         drupal_uninstall_schema($module);
         // Remove the module's entry from the config. Don't check schema when
         // uninstalling a module since we are only clearing a key.
         \Drupal::configFactory()->getEditable('core.extension')->clear("module.{$module}")->save(TRUE);
         // Update the module handler to remove the module.
         // The current ModuleHandler instance is obsolete with the kernel rebuild
         // below.
         $module_filenames = $this->moduleHandler->getModuleList();
         unset($module_filenames[$module]);
         $this->moduleHandler->setModuleList($module_filenames);
         // Remove any potential cache bins provided by the module.
         $this->removeCacheBins($module);
         // Clear the static cache of system_rebuild_module_data() to pick up the
         // new module, since it merges the installation status of modules into
         // its statically cached list.
         drupal_static_reset('system_rebuild_module_data');
         // Clear plugin manager caches.
         \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
         // Update the kernel to exclude the uninstalled modules.
         $this->updateKernel($module_filenames);
         // Update the theme registry to remove the newly uninstalled module.
         drupal_theme_rebuild();
         // Modules can alter theme info, so refresh theme data.
         // @todo ThemeHandler cannot be injected into ModuleHandler, since that
         //   causes a circular service dependency.
         // @see https://www.drupal.org/node/2208429
         \Drupal::service('theme_handler')->refreshInfo();
         \Drupal::logger('system')->info('%module module uninstalled.', array('%module' => $module));
         $schema_store = \Drupal::keyValue('system.schema');
         $schema_store->delete($module);
         /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */
         $post_update_registry = \Drupal::service('update.post_update_registry');
         $post_update_registry->filterOutInvokedUpdatesByModule($module);
     }
     // Rebuild routes after installing module. This is done here on top of
     // \Drupal\Core\Routing\RouteBuilder::destruct to not run into errors on
     // fastCGI which executes ::destruct() after the Module uninstallation page
     // was sent already.
     \Drupal::service('router.builder')->rebuild();
     drupal_get_installed_schema_version(NULL, TRUE);
     // Let other modules react.
     $this->moduleHandler->invokeAll('modules_uninstalled', array($module_list));
     // Flush all persistent caches.
     // Any cache entry might implicitly depend on the uninstalled modules,
     // so clear all of them explicitly.
     $this->moduleHandler->invokeAll('cache_flush');
     foreach (Cache::getBins() as $service_id => $cache_backend) {
         $cache_backend->deleteAll();
     }
     return TRUE;
 }
예제 #15
0
 /**
  * Initializes devel module requirements.
  */
 public function onRequest(GetResponseEvent $event)
 {
     if (!devel_silent()) {
         if ($this->config->get('memory')) {
             global $memory_init;
             $memory_init = memory_get_usage();
         }
         if (devel_query_enabled()) {
             Database::startLog('devel');
         }
         if ($this->account->hasPermission('access devel information')) {
             devel_set_handler(devel_get_handlers());
             // We want to include the class early so that anyone may call krumo()
             // as needed. See http://krumo.sourceforge.net/
             has_krumo();
             // See http://www.firephp.org/HQ/Install.htm
             $path = NULL;
             if (@(include_once 'fb.php') || @(include_once 'FirePHPCore/fb.php')) {
                 // FirePHPCore is in include_path. Probably a PEAR installation.
                 $path = '';
             } elseif ($this->moduleHandler->moduleExists('libraries')) {
                 // Support Libraries API - http://drupal.org/project/libraries
                 $firephp_path = libraries_get_path('FirePHPCore');
                 $firephp_path = $firephp_path ? $firephp_path . '/lib/FirePHPCore/' : '';
                 $chromephp_path = libraries_get_path('chromephp');
             } else {
                 $firephp_path = DRUPAL_ROOT . '/libraries/FirePHPCore/lib/FirePHPCore/';
                 $chromephp_path = './' . drupal_get_path('module', 'devel') . '/chromephp';
             }
             // Include FirePHP if it exists.
             if (!empty($firephp_path) && file_exists($firephp_path . 'fb.php')) {
                 include_once $firephp_path . 'fb.php';
                 include_once $firephp_path . 'FirePHP.class.php';
             }
             // Include ChromePHP if it exists.
             if (!empty($chromephp_path) && file_exists($chromephp_path .= '/ChromePhp.php')) {
                 include_once $chromephp_path;
             }
         }
     }
     if ($this->config->get('rebuild_theme_registry')) {
         drupal_theme_rebuild();
         if (\Drupal::service('flood')->isAllowed('devel.rebuild_registry_warning', 1)) {
             \Drupal::service('flood')->register('devel.rebuild_registry_warning');
             if (!devel_silent() && $this->account->hasPermission('access devel information')) {
                 drupal_set_message(t('The theme registry is being rebuilt on every request. Remember to <a href="!url">turn off</a> this feature on production websites.', array("!url" => url('admin/config/development/devel'))));
             }
         }
     }
     drupal_register_shutdown_function('devel_shutdown');
 }