diff --git a/core/includes/install.inc b/core/includes/install.inc index bcca67c..552b5ed 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -106,6 +106,7 @@ function drupal_install_profile_distribution_name() { // At all other times, we load the profile via standard methods. else { $profile = drupal_get_profile(); + \Drupal::moduleHandler()->load('system'); $info = system_get_info('module', $profile); } return isset($info['distribution']['name']) ? $info['distribution']['name'] : 'Drupal'; diff --git a/core/modules/filter/src/Controller/FilterController.php b/core/modules/filter/src/Controller/FilterController.php index fe4d94f..3dc6ae0 100644 --- a/core/modules/filter/src/Controller/FilterController.php +++ b/core/modules/filter/src/Controller/FilterController.php @@ -28,6 +28,8 @@ class FilterController { function filterTips(FilterFormatInterface $filter_format = NULL) { $tips = $filter_format ? $filter_format->format : -1; + \Drupal::moduleHandler()->load('filter'); + $build = array( '#theme' => 'filter_tips', '#long' => TRUE, diff --git a/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php b/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php index f9a0e1b..12650a9 100644 --- a/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php +++ b/core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php @@ -25,6 +25,7 @@ public function getFormID() { * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { + \Drupal::moduleHandler()->load('language'); $conf = language_get_default_configuration('some_custom_type', 'some_bundle'); $form['lang_configuration'] = array( diff --git a/core/modules/locale/src/Form/ExportForm.php b/core/modules/locale/src/Form/ExportForm.php index 00a4be1..a68c0a5 100644 --- a/core/modules/locale/src/Form/ExportForm.php +++ b/core/modules/locale/src/Form/ExportForm.php @@ -60,6 +60,7 @@ public function getFormID() { public function buildForm(array $form, FormStateInterface $form_state) { $languages = $this->languageManager->getLanguages(); $language_options = array(); + \Drupal::moduleHandler()->load('locale'); foreach ($languages as $langcode => $language) { if ($langcode != 'en' || locale_translate_english()) { $language_options[$langcode] = $language->name; diff --git a/core/modules/locale/src/Form/ImportForm.php b/core/modules/locale/src/Form/ImportForm.php index eda1567..0d2c339 100644 --- a/core/modules/locale/src/Form/ImportForm.php +++ b/core/modules/locale/src/Form/ImportForm.php @@ -78,6 +78,7 @@ public function buildForm(array $form, FormStateInterface $form_state) { // Initialize a language list to the ones available, including English if we // are to translate Drupal to English as well. $existing_languages = array(); + \Drupal::moduleHandler()->load('locale'); foreach ($languages as $langcode => $language) { if ($langcode != 'en' || locale_translate_english()) { $existing_languages[$langcode] = $language->name; diff --git a/core/modules/locale/src/Form/TranslateFormBase.php b/core/modules/locale/src/Form/TranslateFormBase.php index 8ff3cd8..e0531d0 100644 --- a/core/modules/locale/src/Form/TranslateFormBase.php +++ b/core/modules/locale/src/Form/TranslateFormBase.php @@ -163,6 +163,7 @@ protected function translateFilters() { $this->languageManager->reset(); $languages = language_list(); $language_options = array(); + \Drupal::moduleHandler()->load('locale'); foreach ($languages as $langcode => $language) { if ($langcode != 'en' || locale_translate_english()) { $language_options[$langcode] = $language->name; diff --git a/core/modules/system/tests/modules/ajax_test/ajax_test.module b/core/modules/system/tests/modules/ajax_test/ajax_test.module index 870a157..226223a 100644 --- a/core/modules/system/tests/modules/ajax_test/ajax_test.module +++ b/core/modules/system/tests/modules/ajax_test/ajax_test.module @@ -13,121 +13,3 @@ use Drupal\Core\Ajax\HtmlCommand; use Drupal\Core\Url; -/** - * Menu callback: Returns an element suitable for use by - * \Drupal\Core\Ajax\AjaxResponse::ajaxRender(). - * - * Additionally ensures that \Drupal\Core\Ajax\AjaxResponse::ajaxRender() - * incorporates JavaScript settings generated during the page request by - * invoking _drupal_add_js() with a dummy setting. - * - * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::render() - */ -function ajax_test_render() { - $attached = array( - '#attached' => array( - 'js' => array( - 0 => array( - 'type' => 'setting', - 'data' => array('ajax' => 'test'), - ), - ), - ), - ); - // @todo Why is this being tested via an explicit drupal_render() call? - drupal_render($attached); - drupal_process_attached($attached); - $response = new AjaxResponse(); - return $response; -} - -/** - * Menu callback: Returns an AjaxResponse; settings command set last. - * - * Helps verifying AjaxResponse reorders commands to ensure correct execution. - * - * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::order() - */ -function ajax_test_order() { - $response = new AjaxResponse(); - $path = drupal_get_path('module', 'system'); - // HTML insertion command. - $response->addCommand(new HtmlCommand('body', 'Hello, world!')); - $attached = array( - '#attached' => array( - 'css' => array( - // Add two CSS files (order should remain the same). - $path . '/css/system.admin.css' => array(), - $path . '/css/system.maintenance.css' => array(), - ), - 'js' => array( - // Add two JavaScript files (first to the footer, should appear last). - $path . '/system.modules.js' => array('scope' => 'footer'), - $path . '/system.js' => array(), - // Finally, add a JavaScript setting. - 0 => array( - 'type' => 'setting', - 'data' => array('ajax' => 'test'), - ), - ), - ), - ); - - // @todo Why is this being tested via an explicit drupal_render() call? - drupal_render($attached); - drupal_process_attached($attached); - - return $response; -} - -/** - * Menu callback: Returns AJAX element with #error property set. - * - * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::renderError() - */ -function ajax_test_error() { - $message = ''; - $query = \Drupal::request()->query; - if ($query->has('message')) { - $message = $query->get('message'); - } - $response = new AjaxResponse(); - $response->addCommand(new AlertCommand($message)); - return $response; -} - -/** - * Returns example content for dialog tests. - */ -function ajax_test_dialog_contents() { - // This is a regular render array; the keys do not have special meaning. - $content = array( - '#title' => 'AJAX Dialog contents', - 'content' => array( - '#markup' => 'Example message', - ), - 'cancel' => array( - '#type' => 'link', - '#title' => 'Cancel', - '#url' => Url::fromRoute(''), - '#attributes' => array( - // This is a special class to which JavaScript assigns dialog closing - // behavior. - 'class' => array('dialog-cancel'), - ), - ), - ); - - return $content; -} - -/** - * Menu callback: Close the ajax dialog. - * - * @deprecated \Drupal\ajax_test\Controller\AjaxTestController::dialogClose() - */ -function ajax_test_dialog_close() { - $response = new AjaxResponse(); - $response->addCommand(new CloseDialogCommand('#ajax-test-dialog-wrapper-1')); - return $response; -} diff --git a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php index ab25fde..835a065 100644 --- a/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php +++ b/core/modules/system/tests/modules/ajax_test/src/Controller/AjaxTestController.php @@ -18,6 +18,7 @@ class AjaxTestController { * Returns example content for dialog testing. */ public function dialogContents() { + \Drupal::moduleHandler()->load('ajax_test'); // Re-use the utility method that returns the example content. return ajax_test_dialog_contents(); } @@ -26,6 +27,7 @@ public function dialogContents() { * @todo Remove ajax_test_render(). */ public function render() { + \Drupal::moduleHandler()->load('ajax_test'); return ajax_test_render(); } @@ -33,6 +35,7 @@ public function render() { * @todo Remove ajax_test_order(). */ public function order() { + \Drupal::moduleHandler()->load('ajax_test'); return ajax_test_order(); } @@ -40,6 +43,7 @@ public function order() { * @todo Remove ajax_test_error(). */ public function renderError() { + \Drupal::moduleHandler()->load('ajax_test'); return ajax_test_error(); } @@ -140,6 +144,7 @@ public function dialog() { * @todo Remove ajax_test_dialog_close(). */ public function dialogClose() { + \Drupal::moduleHandler()->load('ajax_test'); return ajax_test_dialog_close(); } diff --git a/core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php b/core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php index 21b3ac6..3dd7238 100644 --- a/core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php +++ b/core/modules/system/tests/modules/ajax_test/src/Form/AjaxTestDialogForm.php @@ -97,6 +97,7 @@ public function nonModal(&$form, FormStateInterface $form_state) { * An ajax response object. */ protected function dialog($is_modal = FALSE) { + \Drupal::moduleHandler()->load('ajax_test'); $content = ajax_test_dialog_contents(); $response = new AjaxResponse(); $title = $this->t('AJAX Dialog contents'); diff --git a/core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php b/core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php index d6829fa..f74ef2d 100644 --- a/core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php +++ b/core/modules/system/tests/modules/batch_test/src/Controller/BatchTestController.php @@ -103,6 +103,7 @@ function testProgrammatic($value = 1) { * A redirect response if the batch is progressive. No return value otherwise. */ public function testThemeBatch() { + \Drupal::moduleHandler()->load('batch_test'); batch_test_stack(NULL, TRUE); $batch = array( 'operations' => array( diff --git a/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php b/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php index 5902b09..514fd41 100644 --- a/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php +++ b/core/modules/system/tests/modules/entity_test/src/Routing/EntityTestRoutes.php @@ -21,6 +21,7 @@ class EntityTestRoutes { * An array of route objects. */ public function routes() { + \Drupal::moduleHandler()->load('entity_test'); $types = entity_test_entity_types(); $types[] = 'entity_test_string_id'; $types[] = 'entity_test_no_id'; diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module index a5ce74e..e0387bf 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -81,20 +81,6 @@ function menu_test_menu_local_tasks_alter(&$data, $route_name) { } /** - * Page callback: Provides a dummy function which can be used as a placeholder. - * - * @return string - * A string that can be used for comparison. - * - * @see menu_test_menu(). - * - * @deprecated Use \Drupal\menu_test\Controller\MenuTestController::menuTestCallback() - */ -function menu_test_callback() { - return 'This is menu_test_callback().'; -} - -/** * Page callback: Tests the theme negotiation functionality. * * @param bool $inherited diff --git a/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php b/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php index 05b4333..3ae72ec 100644 --- a/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php +++ b/core/modules/system/tests/modules/menu_test/src/Controller/MenuTestController.php @@ -13,13 +13,17 @@ class MenuTestController { /** - * @todo Remove menu_test_callback(). + * Page callback: Provides a dummy function which can be used as a placeholder. + * + * @return string + * A string that can be used for comparison. + * + * @see menu_test.routing.yml */ public function menuTestCallback() { - return menu_test_callback(); + return 'This is menu_test_callback().'; } - /** * A title callback method for test routes. * diff --git a/core/modules/system/tests/modules/module_test/module_test.module b/core/modules/system/tests/modules/module_test/module_test.module index 60d53ef..651c5db 100644 --- a/core/modules/system/tests/modules/module_test/module_test.module +++ b/core/modules/system/tests/modules/module_test/module_test.module @@ -75,19 +75,6 @@ function module_test_hook_dynamic_loading_invoke() { } /** - * Page callback for 'hook dynamic loading' test. - * - * If the hook is dynamically loaded correctly, the menu callback should - * return 'success!'. - * - * @deprecated \Drupal\module_test\Controller\ModuleTestController::hookDynamicLoadingInvokeAll() - */ -function module_test_hook_dynamic_loading_invoke_all() { - $result = \Drupal::moduleHandler()->invokeAll('test_hook'); - return $result['module_test']; -} - -/** * Load function used by module_test_hook_dynamic_loading_invoke_all_during_load(). * * @see module_test_menu(). @@ -98,23 +85,6 @@ function module_test_load($param) { } /** - * Page callback for 'class loading' test. - * - * This module does not have a dependency on module_autoload_test.module. If - * that module is enabled, this function should return the string - * 'Drupal\\module_autoload_test\\SomeClass::testMethod() was invoked.'. If - * that module is not enabled, this function should return nothing. - * - * @deprecated \Drupal\module_test\Controller\ModuleTestController::testClassLoading() - */ -function module_test_class_loading() { - if (class_exists('Drupal\module_autoload_test\SomeClass')) { - $obj = new Drupal\module_autoload_test\SomeClass(); - return $obj->testMethod(); - } -} - -/** * Implements hook_modules_installed(). */ function module_test_modules_installed($modules) { diff --git a/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php b/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php index df3b8f7..74cb95c 100644 --- a/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php +++ b/core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php @@ -6,6 +6,7 @@ */ namespace Drupal\module_test\Controller; +use Drupal\module_autoload_test\SomeClass; /** * Controller routines for module_test routes. @@ -13,24 +14,40 @@ class ModuleTestController { /** - * @todo Remove module_test_hook_dynamic_loading_invoke(). + * Page callback for 'hook dynamic loading' test. + * + * If the hook is dynamically loaded correctly, the menu callback should + * return 'success!'. */ public function hookDynamicLoadingInvoke() { - return module_test_hook_dynamic_loading_invoke(); + $result = \Drupal::moduleHandler()->invoke('module_test', 'test_hook'); + return $result['module_test']; } /** - * @todo Remove module_test_hook_dynamic_loading_invoke_all(). + * Page callback for 'hook dynamic loading' test. + * + * If the hook is dynamically loaded correctly, the menu callback should + * return 'success!'. */ public function hookDynamicLoadingInvokeAll() { - return module_test_hook_dynamic_loading_invoke_all(); + $result = \Drupal::moduleHandler()->invokeAll('test_hook'); + return $result['module_test']; } /** - * @todo Remove module_test_class_loading(). + * Page callback for 'class loading' test. + * + * This module does not have a dependency on module_autoload_test.module. If + * that module is enabled, this function should return the string + * 'Drupal\\module_autoload_test\\SomeClass::testMethod() was invoked.'. If + * that module is not enabled, this function should return nothing. */ public function testClassLoading() { - return module_test_class_loading(); + if (class_exists('Drupal\module_autoload_test\SomeClass')) { + $obj = new SomeClass(); + return $obj->testMethod(); + } } } diff --git a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php index c6b6903..702af07 100644 --- a/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php +++ b/core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php @@ -72,6 +72,7 @@ public function drupalSetMessageTest() { * @todo Remove system_test_lock_acquire(). */ public function lockAcquire() { + \Drupal::moduleHandler()->load('system_test'); return system_test_lock_acquire(); } @@ -79,6 +80,7 @@ public function lockAcquire() { * @todo Remove system_test_lock_exit(). */ public function lockExit() { + \Drupal::moduleHandler()->load('system_test'); return system_test_lock_exit(); } @@ -128,6 +130,7 @@ public static function preRenderCacheTags($elements) { * @todo Remove system_test_authorize_init_page(). */ public function authorizeInit($page_title) { + \Drupal::moduleHandler()->load('system_test'); return system_test_authorize_init_page($page_title); } @@ -147,6 +150,7 @@ public function setHeader(Request $request) { * @todo Remove system_test_page_shutdown_functions(). */ public function shutdownFunctions($arg1, $arg2) { + \Drupal::moduleHandler()->load('system_test'); system_test_page_shutdown_functions($arg1, $arg2); // If using PHP-FPM then fastcgi_finish_request() will have been fired // preventing further output to the browser which means that the escaping of diff --git a/core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php b/core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php index 76ac189..9f5e771 100644 --- a/core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php +++ b/core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php @@ -16,7 +16,15 @@ class TestPageTestController { * @todo Remove test_page_test_page(). */ public function testPage() { - return test_page_test_page(); + $attached['js'][] = array( + 'data' => array('test-setting' => 'azAZ09();.,\\\/-_{}'), + 'type' => 'setting', + ); + return array( + '#title' => t('Test page'), + '#markup' => t('Test page text.'), + '#attached' => $attached, + ); } } diff --git a/core/modules/system/tests/modules/test_page_test/test_page_test.module b/core/modules/system/tests/modules/test_page_test/test_page_test.module deleted file mode 100644 index 93c10c5..0000000 --- a/core/modules/system/tests/modules/test_page_test/test_page_test.module +++ /dev/null @@ -1,18 +0,0 @@ - array('test-setting' => 'azAZ09();.,\\\/-_{}'), - 'type' => 'setting', - ); - return array( - '#title' => t('Test page'), - '#markup' => t('Test page text.'), - '#attached' => $attached, - ); -} diff --git a/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php b/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php index a2b459f..03d2184 100644 --- a/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php +++ b/core/modules/update/tests/modules/update_test/src/Controller/UpdateTestController.php @@ -6,6 +6,7 @@ */ namespace Drupal\update_test\Controller; +use Symfony\Component\HttpFoundation\BinaryFileResponse; use Symfony\Component\HttpFoundation\Response; /** @@ -32,7 +33,30 @@ public function updateError() { * @todo Remove update_test_mock_page(). */ public function updateTest($project_name, $version) { - return update_test_mock_page($project_name, $version); + $xml_map = $this->config('update_test.settings')->get('xml_map'); + if (isset($xml_map[$project_name])) { + $availability_scenario = $xml_map[$project_name]; + } + elseif (isset($xml_map['#all'])) { + $availability_scenario = $xml_map['#all']; + } + else { + // The test didn't specify (for example, the webroot has other modules and + // themes installed but they're disabled by the version of the site + // running the test. So, we default to a file we know won't exist, so at + // least we'll get an empty xml response instead of a bunch of Drupal page + // output. + $availability_scenario = '#broken#'; + } + + $path = drupal_get_path('module', 'update_test'); + $file = "$path/$project_name.$availability_scenario.xml"; + $headers = array('Content-Type' => 'text/xml; charset=utf-8'); + if (!is_file($file)) { + // Return an empty response. + return new Response('', 200, $headers); + } + return new BinaryFileResponse($file, 200, $headers); } } diff --git a/core/modules/update/tests/modules/update_test/update_test.module b/core/modules/update/tests/modules/update_test/update_test.module index 93c97f4..f8de3cd 100644 --- a/core/modules/update/tests/modules/update_test/update_test.module +++ b/core/modules/update/tests/modules/update_test/update_test.module @@ -1,8 +1,6 @@ get('xml_map'); - if (isset($xml_map[$project_name])) { - $availability_scenario = $xml_map[$project_name]; - } - elseif (isset($xml_map['#all'])) { - $availability_scenario = $xml_map['#all']; - } - else { - // The test didn't specify (for example, the webroot has other modules and - // themes installed but they're disabled by the version of the site - // running the test. So, we default to a file we know won't exist, so at - // least we'll get an empty xml response instead of a bunch of Drupal page - // output. - $availability_scenario = '#broken#'; - } - - $path = drupal_get_path('module', 'update_test'); - $file = "$path/$project_name.$availability_scenario.xml"; - $headers = array('Content-Type' => 'text/xml; charset=utf-8'); - if (!is_file($file)) { - // Return an empty response. - return new Response('', 200, $headers); - } - return new BinaryFileResponse($file, 200, $headers); -} - -/** * Implements hook_filetransfer_info(). */ function update_test_filetransfer_info() {