diff -u b/core/includes/install.core.inc b/core/includes/install.core.inc --- b/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -368,7 +368,8 @@ ->addArgument('cache'); $container ->register('theme.registry', 'Drupal\Core\Theme\Registry') - ->addArgument(new Reference('cache.theme')); + ->addArgument(new Reference('cache.theme')) + ->addArgument(new Reference('module_handler')); // Register a module handler for managing enabled modules. $container diff -u b/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php --- b/core/lib/Drupal/Core/CoreBundle.php +++ b/core/lib/Drupal/Core/CoreBundle.php @@ -208,7 +208,8 @@ ->addArgument('cache'); $container ->register('theme.registry', 'Drupal\Core\Theme\Registry') - ->addArgument(new Reference('cache.theme')); + ->addArgument(new Reference('cache.theme')) + ->addArgument(new Reference('module_handler')); $this->registerTwig($container); $this->registerRouting($container); diff -u b/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php --- b/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\NestedArray; use Drupal\Core\Cache\CacheBackendInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Utility\ThemeRegistry; /** @@ -92,24 +93,33 @@ protected $cache; /** + * The module handler to use to load modules. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface + */ + protected $moduleHandler; + + /** * The incomplete, runtime theme registry. * * @var \Drupal\Core\Utility\ThemeRegistry */ protected $runtimeRegistry; + /** * Constructs a new theme registry instance. * * @param \Drupal\Core\Cache\CacheBackendInterface $cache * The cache backend interface to use for the complete theme registry data. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The module handler to use to load modules. * @param string $theme_name * (optional) The name of the theme for which to construct the registry. - * - * @todo Inject new ModuleHandler. */ - public function __construct(CacheBackendInterface $cache, $theme_name = NULL) { + public function __construct(CacheBackendInterface $cache, ModuleHandlerInterface $module_handler, $theme_name = NULL) { $this->cache = $cache; + $this->moduleHandler = $module_handler; $this->init($theme_name); } @@ -219,7 +229,7 @@ else { $this->registry = $this->build(); // Only persist it if all modules are loaded to ensure it is complete. - if (\Drupal::service('module_handler')->loadAll()) { + if ($this->moduleHandler->loadAll()) { $this->setCache(); } } @@ -284,12 +294,12 @@ $registry = $cache->data; } else { - foreach (module_implements('theme') as $module) { + foreach ($this->moduleHandler->getImplementations('theme') as $module) { $this->processExtension($registry, 'module', $module, $module, drupal_get_path('module', $module)); } // Only persist it if all modules are loaded to ensure it is complete. // @todo Get rid of these checks. - if (\Drupal::service('module_handler')->loadAll()) { + if ($this->moduleHandler->loadAll()) { $this->cache->set("theme_registry:build:modules", $registry, CacheBackendInterface::CACHE_PERMANENT, array('theme_registry' => TRUE)); } } @@ -311,7 +321,7 @@ $this->processExtension($registry, 'theme', $this->theme->name, $this->theme->name, dirname($this->theme->uri)); // Allow modules to alter the complete registry. - drupal_alter('theme_registry', $registry); + $this->moduleHandler->alter('theme_registry', $registry); $this->registry = $registry; $this->compile(); @@ -647,7 +657,7 @@ */ protected function getHookImplementations($hook) { $implementations = array(); - foreach (module_implements($hook) as $module) { + foreach ($this->moduleHandler->getImplementations($hook) as $module) { $function = $module . '_' . $hook; $implementations[$function] = $function; }; diff -u b/core/modules/views/views_ui/views_ui.module b/core/modules/views/views_ui/views_ui.module --- b/core/modules/views/views_ui/views_ui.module +++ b/core/modules/views/views_ui/views_ui.module @@ -123,11 +123,13 @@ 'variables' => array('description' => '', 'link' => '', 'settings_links' => array(), 'overridden' => FALSE, 'defaulted' => FALSE, 'description_separator' => TRUE, 'class' => array()), 'template' => 'views-ui-display-tab-setting', 'file' => 'views_ui.theme.inc', + 'preprocess' => array('template_preprocess_views_ui_display_tab_setting'), ), 'views_ui_display_tab_bucket' => array( 'render element' => 'element', 'template' => 'views-ui-display-tab-bucket', 'file' => 'views_ui.theme.inc', + 'preprocess' => array('template_preprocess_views_ui_display_tab_bucket'), ), 'views_ui_rearrange_form' => array( 'render element' => 'form', @@ -146,6 +148,7 @@ 'views_ui_view_info' => array( 'variables' => array('view' => NULL, 'base' => NULL), 'file' => 'views_ui.theme.inc', + 'preprocess' => array('template_preprocess_views_ui_view_info'), ), // Group of filters. @@ -176,6 +179,7 @@ 'views_ui_view_preview_section' => array( 'variables' => array('view' => NULL, 'section' => NULL, 'content' => NULL, 'links' => ''), 'file' => 'views_ui.theme.inc', + 'preprocess' => array('template_preprocess_views_ui_view_preview_section'), ), // Generic container wrapper, to use instead of theme_container when an id