diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 9daa71a..5c1bb44 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2222,18 +2222,6 @@ function drupal_alter($type, &$data, &$context1 = NULL, &$context2 = NULL) { } /** - * Determines whether a given module exists. - * - * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->moduleExists($hook). - * - * @see \Drupal\Core\Extension\ModuleHandler::moduleExists() - */ -function module_exists($module) { - return Drupal::moduleHandler()->moduleExists($module); -} - -/** * Determines whether a module implements a hook. * * @deprecated as of Drupal 8.0. Use @@ -2459,7 +2447,7 @@ function language_list($flags = Language::STATE_CONFIGURABLE) { // Fill in master language list based on current configuration. $default = language_default(); - if (language_multilingual() || module_exists('language')) { + if (language_multilingual() || Drupal::moduleHandler()->moduleExists('language')) { // Use language module configuration if available. $language_entities = config_get_storage_names_with_prefix('language.entity'); diff --git a/core/includes/menu.inc b/core/includes/menu.inc index c90575e..260914d 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -1819,7 +1819,7 @@ function menu_list_system_menus() { */ function menu_main_menu() { $config = config('menu.settings'); - $menu_enabled = module_exists('menu'); + $menu_enabled = Drupal::moduleHandler()->moduleExists('menu'); // When menu module is not enabled, we need a hardcoded default value. $main_links_source = $menu_enabled ? $config->get('main_links') : 'main'; return menu_navigation_links($main_links_source); @@ -1830,7 +1830,7 @@ function menu_main_menu() { */ function menu_secondary_menu() { $config = config('menu.settings'); - $menu_enabled = module_exists('menu'); + $menu_enabled = Drupal::moduleHandler()->moduleExists('menu'); // When menu module is not enabled, we need a hardcoded default value. $main_links_source = $menu_enabled ? $config->get('main_links') : 'main'; $secondary_links_source = $menu_enabled ? $config->get('secondary_links') : 'account'; @@ -2837,7 +2837,7 @@ function menu_get_router() { * @todo This function should be removed/refactored. */ function _menu_navigation_links_rebuild($menu) { - if (module_exists('menu_link')) { + if (Drupal::moduleHandler()->moduleExists('menu_link')) { $menu_link_controller = Drupal::entityManager() ->getStorageController('menu_link'); } diff --git a/core/includes/update.inc b/core/includes/update.inc index cf25b03..c0253fa 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -1624,7 +1624,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) { // Fill in master language list based on current configuration. $default = language_default(); - if (language_multilingual() || module_exists('language')) { + if (language_multilingual() || Drupal::moduleHandler()->moduleExists('language')) { // Use language module configuration if available. We can not use // entity_load_multiple() because this breaks during updates. $language_entities = config_get_storage_names_with_prefix('language.entity'); diff --git a/core/modules/block/block.module b/core/modules/block/block.module index cfbad28..10a2a27 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -59,7 +59,7 @@ function block_help($path, $arg) { $output .= '
' . t('When working with blocks, remember that all themes do not implement the same regions, or display regions in the same way. Blocks are positioned on a per-theme basis. Users with the Administer blocks permission can disable blocks. Disabled blocks are listed on the Blocks administration page, but are not displayed in any region.', array('@block' => 'http://drupal.org/documentation/modules/block', '@blocks' => url('admin/structure/block'))) . '
'; $output .= '
' . t('Controlling visibility') . '
'; $output .= '
' . t('Blocks can be configured to be visible only on certain pages, only to users of certain roles, or only on pages displaying certain content types. Some dynamic blocks, such as those generated by modules, will be displayed only on certain pages.', array('@content-type' => url('admin/structure/types'), '@user' => url('user'))) . '
'; - if (module_exists('custom_block')) { + if (Drupal::moduleHandler()->moduleExists('custom_block')) { $output .= '
' . t('Creating custom blocks') . '
'; $output .= '
' . t('Users with the Administer blocks permission can add custom blocks, which are then listed on the Blocks administration page. Once created, custom blocks behave just like default and module-generated blocks.', array('@blocks' => url('admin/structure/block'), '@block-add' => url('admin/structure/block/list/block_plugin_ui:' . config('system.theme')->get('default') . '/add/custom_blocks'))) . '
'; } diff --git a/core/modules/block/custom_block/custom_block.module b/core/modules/block/custom_block/custom_block.module index 4e55a85..30f500f 100644 --- a/core/modules/block/custom_block/custom_block.module +++ b/core/modules/block/custom_block/custom_block.module @@ -146,7 +146,7 @@ function custom_block_load($id) { */ function custom_block_entity_info_alter(&$types) { // Add a translation handler for fields if the language module is enabled. - if (module_exists('language')) { + if (Drupal::moduleHandler()->moduleExists('language')) { $types['custom_block']['translation']['custom_block'] = TRUE; } } diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php index cf88f5d..7990f5a 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeFormController.php @@ -52,7 +52,7 @@ public function form(array $form, array &$form_state) { '#description' => t('Create a new revision by default for this block type.') ); - if (module_exists('content_translation')) { + if (Drupal::moduleHandler()->moduleExists('content_translation')) { $form['language'] = array( '#type' => 'details', '#title' => t('Language settings'), diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeListController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeListController.php index 346cdff..64e2fd2 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeListController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockTypeListController.php @@ -20,7 +20,7 @@ class CustomBlockTypeListController extends ConfigEntityListController { */ public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); - if (module_exists('field_ui')) { + if (Drupal::moduleHandler()->moduleExists('field_ui')) { $uri = $entity->uri(); $operations['manage-fields'] = array( 'title' => t('Manage fields'), diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php index 0d17fa1..0949c8f 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Plugin/Block/CustomBlockBlock.php @@ -61,7 +61,7 @@ public function blockForm($form, &$form_state) { */ public function blockSubmit($form, &$form_state) { // Invalidate the block cache to update custom block-based derivatives. - if (module_exists('block')) { + if (Drupal::moduleHandler()->moduleExists('block')) { drupal_container()->get('plugin.manager.block')->clearCachedDefinitions(); } } diff --git a/core/modules/block/lib/Drupal/block/BlockAccessController.php b/core/modules/block/lib/Drupal/block/BlockAccessController.php index 372e56d..2d89009 100644 --- a/core/modules/block/lib/Drupal/block/BlockAccessController.php +++ b/core/modules/block/lib/Drupal/block/BlockAccessController.php @@ -73,7 +73,7 @@ protected function checkAccess(EntityInterface $entity, $operation, $langcode, A // listed in $block->pages. $page_match = !($visibility['path']['visibility'] xor $page_match); } - elseif (module_exists('php')) { + elseif (Drupal::moduleHandler()->moduleExists('php')) { $page_match = php_eval($visibility['path']['pages']); } diff --git a/core/modules/block/lib/Drupal/block/BlockFormController.php b/core/modules/block/lib/Drupal/block/BlockFormController.php index f562a68..b1f78dc 100644 --- a/core/modules/block/lib/Drupal/block/BlockFormController.php +++ b/core/modules/block/lib/Drupal/block/BlockFormController.php @@ -85,7 +85,7 @@ public function form(array $form, array &$form_state) { ); $description = t("Specify pages by using their paths. Enter one path per line. The '*' character is a wildcard. Example paths are %user for the current user's page and %user-wildcard for every user page. %front is the front page.", array('%user' => 'user', '%user-wildcard' => 'user/*', '%front' => '')); - if (module_exists('php') && $access) { + if (Drupal::moduleHandler()->moduleExists('php') && $access) { $options += array(BLOCK_VISIBILITY_PHP => t('Pages on which this PHP code returns TRUE (experts only)')); $title = t('Pages or PHP code'); $description .= ' ' . t('If the PHP option is chosen, enter PHP code between %php. Note that executing incorrect PHP code can break your Drupal site.', array('%php' => '')); @@ -108,7 +108,7 @@ public function form(array $form, array &$form_state) { } // Configure the block visibility per language. - if (module_exists('language') && language_multilingual()) { + if (Drupal::moduleHandler()->moduleExists('language') && language_multilingual()) { $configurable_language_types = language_types_get_configurable(); // Fetch languages. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php index 7f7855d..88e5edd 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -207,7 +207,7 @@ function moveBlockToRegion(array $block, $region) { */ function testBlockRehash() { module_enable(array('block_test')); - $this->assertTrue(module_exists('block_test'), 'Test block module enabled.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('block_test'), 'Test block module enabled.'); // Clear the block cache to load the block_test module's block definitions. $this->container->get('plugin.manager.block')->clearCachedDefinitions(); @@ -240,7 +240,7 @@ function testBlockRehash() { */ function testBlockModuleDisable() { module_enable(array('block_test')); - $this->assertTrue(module_exists('block_test'), 'Test block module enabled.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('block_test'), 'Test block module enabled.'); // Clear the block cache to load the block_test module's block definitions. $manager = $this->container->get('plugin.manager.block'); @@ -259,7 +259,7 @@ function testBlockModuleDisable() { // Disable the block test module and refresh the definitions cache. module_disable(array('block_test'), FALSE); - $this->assertFalse(module_exists('block_test'), 'Test block module disabled.'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('block_test'), 'Test block module disabled.'); $manager->clearCachedDefinitions(); // Ensure that the block administration page still functions as expected. @@ -304,7 +304,7 @@ function testBlockModuleDisable() { // Re-enable the module and refresh the definitions cache. module_enable(array('block_test'), FALSE); - $this->assertTrue(module_exists('block_test'), 'Test block module re-enabled.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('block_test'), 'Test block module re-enabled.'); $manager->clearCachedDefinitions(); // Reload the admin page and confirm the block can again be configured. diff --git a/core/modules/breakpoint/breakpoint.module b/core/modules/breakpoint/breakpoint.module index ce3c894..00732b0 100644 --- a/core/modules/breakpoint/breakpoint.module +++ b/core/modules/breakpoint/breakpoint.module @@ -277,7 +277,7 @@ function breakpoint_get_theme_media_queries($theme_key) { * An array of breakpoints in the form $breakpoint['name'] = 'media query'. */ function breakpoint_get_module_media_queries($module) { - if (!module_exists($module)) { + if (!Drupal::moduleHandler()->moduleExists($module)) { throw new \Exception('Illegal module name passed.'); } diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index f436966..14b81ed 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -915,7 +915,7 @@ function comment_links(Comment $comment, EntityInterface $node) { } // Add translations link for translation-enabled comment bundles. - if (module_exists('content_translation') && content_translation_translate_access($comment)) { + if (Drupal::moduleHandler()->moduleExists('content_translation') && content_translation_translate_access($comment)) { $links['comment-translations'] = array( 'title' => t('translate'), 'href' => 'comment/' . $comment->id() . '/translations', @@ -1021,7 +1021,7 @@ function comment_form_node_type_form_alter(&$form, $form_state) { ), ); // @todo Remove this check once language settings are generalized. - if (module_exists('content_translation')) { + if (Drupal::moduleHandler()->moduleExists('content_translation')) { $comment_form = $form; $comment_form_state['content_translation']['key'] = 'language_configuration'; $form['comment'] += content_translation_enable_widget('comment', 'comment_node_' . $node_type->id(), $comment_form, $comment_form_state); @@ -1325,7 +1325,7 @@ function comment_load($cid, $reset = FALSE) { function comment_num_new($nid, $timestamp = 0) { global $user; - if ($user->isAuthenticated() && module_exists('history')) { + if ($user->isAuthenticated() && Drupal::moduleHandler()->moduleExists('history')) { // Retrieve the timestamp at which the current user last viewed this node. if (!$timestamp) { $timestamp = history_read($nid); diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index 66e2083..8fbb068 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -141,7 +141,7 @@ function comment_views_data() { ), ); - if (module_exists('language')) { + if (Drupal::moduleHandler()->moduleExists('language')) { $data['comment']['langcode'] = array( 'title' => t('Language'), 'help' => t('The language the comment is in.'), diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php index ecd464a..a532516 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php @@ -73,7 +73,7 @@ function testCommentEnable() { $edit['modules[Core][comment][enable]'] = FALSE; $this->drupalPost('admin/modules', $edit, t('Save configuration')); $this->rebuildContainer(); - $this->assertFalse(module_exists('comment'), 'Comment module disabled.'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('comment'), 'Comment module disabled.'); // Enable core content type module (book). $edit = array(); @@ -85,7 +85,7 @@ function testCommentEnable() { $edit['modules[Core][comment][enable]'] = 'comment'; $this->drupalPost('admin/modules', $edit, t('Save configuration')); $this->rebuildContainer(); - $this->assertTrue(module_exists('comment'), 'Comment module enabled.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('comment'), 'Comment module enabled.'); // Create nodes of each type. $book_node = $this->drupalCreateNode(array('type' => 'book')); diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php index 119774b..4f9b64a 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestFormController.php @@ -47,7 +47,7 @@ public function form(array $form, array &$form_state) { '#default_value' => $entity->get('style'), '#access' => FALSE, ); - if (module_exists('image')) { + if (Drupal::moduleHandler()->moduleExists('image')) { $form['style']['#access'] = TRUE; $form['style']['#options'] = image_style_options(); } diff --git a/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc index e277791..0f87059 100644 --- a/core/modules/content_translation/content_translation.pages.inc +++ b/core/modules/content_translation/content_translation.pages.inc @@ -21,7 +21,7 @@ function content_translation_overview(EntityInterface $entity) { $languages = language_list(); $original = $entity->getUntranslated()->language()->id; $translations = $entity->getTranslationLanguages(); - $field_ui = module_exists('field_ui') && user_access('administer ' . $entity->entityType() . ' fields'); + $field_ui = Drupal::moduleHandler()->moduleExists('field_ui') && user_access('administer ' . $entity->entityType() . ' fields'); $path = $controller->getViewPath($entity); $base_path = $controller->getBasePath($entity); @@ -286,7 +286,7 @@ function content_translation_delete_confirm_submit(array $form, array &$form_sta // Remove any existing path alias for the removed translation. // @todo This should be taken care of by the Path module. - if (module_exists('path')) { + if (Drupal::moduleHandler()->moduleExists('path')) { $conditions = array('source' => $controller->getViewPath($entity), 'langcode' => $language->id); Drupal::service('path.crud')->delete($conditions); } diff --git a/core/modules/dblog/dblog.module b/core/modules/dblog/dblog.module index 202cfcf..4dbe3ed 100644 --- a/core/modules/dblog/dblog.module +++ b/core/modules/dblog/dblog.module @@ -69,7 +69,7 @@ function dblog_menu() { 'file' => 'dblog.admin.inc', ); - if (module_exists('search')) { + if (Drupal::moduleHandler()->moduleExists('search')) { $items['admin/reports/search'] = array( 'title' => 'Top search phrases', 'description' => 'View most popular search phrases.', diff --git a/core/modules/email/email.module b/core/modules/email/email.module index 6afbdeb..a63a813 100644 --- a/core/modules/email/email.module +++ b/core/modules/email/email.module @@ -37,7 +37,7 @@ function email_field_info() { * Implements hook_field_info_alter(). */ function email_field_info_alter(&$info) { - if (module_exists('text')) { + if (Drupal::moduleHandler()->moduleExists('text')) { $info['email']['default_formatter'] = 'text_plain'; } } diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module index 54a7bac..327fbb6 100644 --- a/core/modules/entity_reference/entity_reference.module +++ b/core/modules/entity_reference/entity_reference.module @@ -20,7 +20,7 @@ function entity_reference_field_info() { 'description' => t('This field references another entity.'), 'settings' => array( // Default to a primary entity type (i.e. node or user). - 'target_type' => module_exists('node') ? 'node' : 'user', + 'target_type' => Drupal::moduleHandler()->moduleExists('node') ? 'node' : 'user', ), 'instance_settings' => array( // The selection handler for this instance. diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index 02fd704..d8db12e 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -43,7 +43,7 @@ */ function hook_field_extra_fields() { $extra = array(); - $module_language_enabled = module_exists('language'); + $module_language_enabled = Drupal::moduleHandler()->moduleExists('language'); $description = t('Node module element'); foreach (node_type_get_types() as $bundle) { diff --git a/core/modules/field/field.module b/core/modules/field/field.module index 92a2c45..85b380c 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -214,7 +214,7 @@ function field_system_info_alter(&$info, $file, $type) { } } if ($non_deleted) { - if (module_exists('field_ui')) { + if (Drupal::moduleHandler()->moduleExists('field_ui')) { $explanation = t('Field type(s) in use - see Field list', array('@fields-page' => url('admin/reports/fields'))); } else { diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index 8297e80..409d521 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -118,7 +118,7 @@ function testEnableForumField() { $this->drupalPost('admin/modules', $edit, t('Save configuration')); $this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.'); $this->rebuildContainer(); - $this->assertFalse(module_exists('forum'), 'Forum module is not enabled.'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('forum'), 'Forum module is not enabled.'); // Attempt to re-enable the Forum module and ensure it does not try to // recreate the taxonomy_forums field. @@ -127,7 +127,7 @@ function testEnableForumField() { $this->drupalPost('admin/modules', $edit, t('Save configuration')); $this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.'); $this->rebuildContainer(); - $this->assertTrue(module_exists('forum'), 'Forum module is enabled.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('forum'), 'Forum module is enabled.'); } /** diff --git a/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php index 73596c8..a0cd398 100644 --- a/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php +++ b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php @@ -80,7 +80,7 @@ public function denormalize($data, $class, $format = NULL, array $context = arra if (isset($data['langcode'])) { $langcode = $data['langcode'][0]['value']; } - elseif (module_exists('language')) { + elseif (Drupal::moduleHandler()->moduleExists('language')) { $langcode = language_get_default_langcode($typed_data_ids['entity_type'], $typed_data_ids['bundle']); } else { diff --git a/core/modules/help/help.module b/core/modules/help/help.module index 75c15ab..14747af 100644 --- a/core/modules/help/help.module +++ b/core/modules/help/help.module @@ -41,7 +41,7 @@ function help_help($path, $arg) { $output .= '
  • ' . t('Enable additional functionality Next, visit the module list and enable features which suit your specific needs. You can find additional modules in the Drupal modules download section.', array('@modules' => url('admin/modules'), '@download_modules' => 'http://drupal.org/project/modules')) . '
  • '; $output .= '
  • ' . t('Customize your website design To change the "look and feel" of your website, visit the themes section. You may choose from one of the included themes or download additional themes from the Drupal themes download section.', array('@themes' => url('admin/appearance'), '@download_themes' => 'http://drupal.org/project/themes')) . '
  • '; // Display a link to the create content page if Node module is enabled. - if (module_exists('node')) { + if (Drupal::moduleHandler()->moduleExists('node')) { $output .= '
  • ' . t('Start posting content Finally, you can add new content for your website.', array('@content' => url('node/add'))) . '
  • '; } $output .= ''; diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php index ab81c8e..1e40371 100644 --- a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php +++ b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php @@ -34,7 +34,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o if ($user->isAuthenticated()) { $this->additional_fields['created'] = array('table' => 'node_field_data', 'field' => 'created'); $this->additional_fields['changed'] = array('table' => 'node_field_data', 'field' => 'changed'); - if (module_exists('comment') && !empty($this->options['comments'])) { + if (Drupal::moduleHandler()->moduleExists('comment') && !empty($this->options['comments'])) { $this->additional_fields['last_comment'] = array('table' => 'node_comment_statistics', 'field' => 'last_comment_timestamp'); } } @@ -50,7 +50,7 @@ protected function defineOptions() { public function buildOptionsForm(&$form, &$form_state) { parent::buildOptionsForm($form, $form_state); - if (module_exists('comment')) { + if (Drupal::moduleHandler()->moduleExists('comment')) { $form['comments'] = array( '#type' => 'checkbox', '#title' => t('Check for new comments as well'), @@ -78,7 +78,7 @@ public function render($values) { $last_read = $this->getValue($values); $changed = $this->getValue($values, 'changed'); - $last_comment = module_exists('comment') && !empty($this->options['comments']) ? $this->getValue($values, 'last_comment') : 0; + $last_comment = Drupal::moduleHandler()->moduleExists('comment') && !empty($this->options['comments']) ? $this->getValue($values, 'last_comment') : 0; if (!$last_read && $changed > HISTORY_READ_LIMIT) { $mark = MARK_NEW; diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php index beae395..40b4c5e 100644 --- a/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php +++ b/core/modules/history/lib/Drupal/history/Plugin/views/filter/HistoryUserTimestamp.php @@ -75,7 +75,7 @@ public function query() { $clause = ''; $clause2 = ''; - if (module_exists('comment')) { + if (Drupal::moduleHandler()->moduleExists('comment')) { $ncs = $this->query->ensureTable('node_comment_statistics', $this->relationship); $clause = ("OR $ncs.last_comment_timestamp > (***CURRENT_TIME*** - $limit)"); $clause2 = "OR $field < $ncs.last_comment_timestamp"; diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc index 041398e..cb14aa3 100644 --- a/core/modules/language/language.admin.inc +++ b/core/modules/language/language.admin.inc @@ -518,7 +518,7 @@ function language_negotiation_configure_form_submit($form, &$form_state) { // Clear block definitions cache since the available blocks and their names // may have been changed based on the configurable types. - if (module_exists('block')) { + if (Drupal::moduleHandler()->moduleExists('block')) { // If there is an active language switcher for a language type that has been // made not configurable, deactivate it first. $non_configurable = array_keys(array_diff($customized, array_filter($customized))); diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index af081e5..86cd53e 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -45,7 +45,7 @@ function menu_help($path, $arg) { case 'admin/structure/menu/add': return '

    ' . t('You can enable the newly-created block for this menu on the Blocks administration page.', array('@blocks' => url('admin/structure/block'))) . '

    '; } - if ($path == 'admin/structure/menu' && module_exists('block')) { + if ($path == 'admin/structure/menu' && Drupal::moduleHandler()->moduleExists('block')) { return '

    ' . t('Each menu has a corresponding block that is managed on the Blocks administration page.', array('@blocks' => url('admin/structure/block'))) . '

    '; } } @@ -252,7 +252,7 @@ function menu_load($menu_name) { function menu_menu_insert(Menu $menu) { menu_cache_clear_all(); // Invalidate the block cache to update menu-based derivatives. - if (module_exists('block')) { + if (Drupal::moduleHandler()->moduleExists('block')) { Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } // Make sure the menu is present in the active menus variable so that its @@ -275,7 +275,7 @@ function menu_menu_insert(Menu $menu) { function menu_menu_update(Menu $menu) { menu_cache_clear_all(); // Invalidate the block cache to update menu-based derivatives. - if (module_exists('block')) { + if (Drupal::moduleHandler()->moduleExists('block')) { Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } } @@ -304,7 +304,7 @@ function menu_menu_delete(Menu $menu) { menu_cache_clear_all(); // Invalidate the block cache to update menu-based derivatives. - if (module_exists('block')) { + if (Drupal::moduleHandler()->moduleExists('block')) { Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } } diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php index 01a3535..81ef2da 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php @@ -135,7 +135,7 @@ public function getBCEntity() { * {@inheritdoc} */ public static function preDelete(EntityStorageControllerInterface $storage_controller, array $entities) { - if (module_exists('search')) { + if (Drupal::moduleHandler()->moduleExists('search')) { foreach ($entities as $id => $entity) { search_reindex($entity->nid->value, 'node'); } diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php index 0851b25..8cceb8b 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Node.php @@ -7,6 +7,7 @@ namespace Drupal\node\Plugin\views\field; +use Drupal; use Drupal\views\ViewExecutable; use Drupal\views\Plugin\views\display\DisplayPluginBase; use Drupal\views\Plugin\views\field\FieldPluginBase; @@ -32,7 +33,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o // Don't add the additional fields to groupby if (!empty($this->options['link_to_node'])) { $this->additional_fields['nid'] = array('table' => 'node', 'field' => 'nid'); - if (module_exists('translation')) { + if (Drupal::moduleHandler()->moduleExists('translation')) { $this->additional_fields['langcode'] = array('table' => 'node', 'field' => 'langcode'); } } diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Revision.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Revision.php index 410b2e0..feb7798 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Revision.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Revision.php @@ -30,7 +30,7 @@ public function init(ViewExecutable $view, DisplayPluginBase $display, array &$o if (!empty($this->options['link_to_node_revision'])) { $this->additional_fields['vid'] = 'vid'; $this->additional_fields['nid'] = 'nid'; - if (module_exists('translation')) { + if (Drupal::moduleHandler()->moduleExists('translation')) { $this->additional_fields['langcode'] = array('table' => 'node', 'field' => 'langcode'); } } @@ -65,7 +65,7 @@ function render_link($data, $values) { $nid = $this->getValue($values, 'nid'); $vid = $this->getValue($values, 'vid'); $this->options['alter']['path'] = "node/" . $nid . '/revisions/' . $vid . '/view'; - if (module_exists('translation')) { + if (Drupal::moduleHandler()->moduleExists('translation')) { $langcode = $this->getValue($values, 'langcode'); $languages = language_list(); if (isset($languages[$langcode])) { diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 45f19c7..c6d3abf 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -281,7 +281,7 @@ function node_mark($nid, $timestamp) { global $user; $cache = &drupal_static(__FUNCTION__, array()); - if ($user->isAnonymous() || !module_exists('history')) { + if ($user->isAnonymous() || !Drupal::moduleHandler()->moduleExists('history')) { return MARK_READ; } if (!isset($cache[$nid])) { @@ -445,7 +445,7 @@ function node_add_body_field(NodeTypeInterface $type, $label = 'Body') { */ function node_field_extra_fields() { $extra = array(); - $module_language_enabled = module_exists('language'); + $module_language_enabled = Drupal::moduleHandler()->moduleExists('language'); $description = t('Node module element'); foreach (node_type_get_types() as $bundle) { @@ -629,7 +629,7 @@ function node_show(EntityInterface $node, $message = FALSE) { $nodes = array('nodes' => node_view_multiple(array($node->id() => $node), 'full')); // Update the history table, stating that this user viewed this node. - if (module_exists('history')) { + if (Drupal::moduleHandler()->moduleExists('history')) { history_write($node->id()); } @@ -2048,7 +2048,7 @@ function node_access($op, $node, $account = NULL, $langcode = NULL) { $langcode = $node->language()->id; // If the Language module is enabled, try to use the language from content // negotiation. - if (module_exists('language')) { + if (Drupal::moduleHandler()->moduleExists('language')) { // Load languages the node exists in. $node_translations = $node->getTranslationLanguages(); // Load the language from content negotiation. @@ -2609,6 +2609,6 @@ function node_library_info() { */ function node_system_info_alter(&$info, $file, $type) { if ($type == 'module' && $file->name == 'translation') { - $info['hidden'] = !module_exists('translation') && config('system.module.disabled')->get('translation') === NULL; + $info['hidden'] = !Drupal::moduleHandler()->moduleExists('translation') && config('system.module.disabled')->get('translation') === NULL; } } diff --git a/core/modules/node/node.views.inc b/core/modules/node/node.views.inc index b2d00a6..2734844 100644 --- a/core/modules/node/node.views.inc +++ b/core/modules/node/node.views.inc @@ -198,7 +198,7 @@ function node_views_data() { ), ); - if (module_exists('language')) { + if (Drupal::moduleHandler()->moduleExists('language')) { $data['node']['langcode'] = array( 'title' => t('Language'), 'help' => t('The language the content is in.'), @@ -645,7 +645,7 @@ function node_row_node_view_preprocess_node(&$variables) { */ function node_views_wizard() { // @todo: figure this piece out. - if (module_exists('statistics')) { + if (Drupal::moduleHandler()->moduleExists('statistics')) { $plugins['node']['available_sorts']['node_counter-totalcount:DESC'] = t('Number of hits'); } diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module index 3e6f989..5de7a95 100644 --- a/core/modules/overlay/overlay.module +++ b/core/modules/overlay/overlay.module @@ -500,7 +500,7 @@ function overlay_overlay_parent_initialize() { } drupal_add_js(array('overlay' => array('paths' => $paths)), 'setting'); $path_prefixes = array(); - if (module_exists('language')) { + if (Drupal::moduleHandler()->moduleExists('language')) { language_negotiation_include(); if (config('language.negotiation')->get('url.source') == LANGUAGE_NEGOTIATION_URL_PREFIX) { // Skip the empty string indicating the default language. We always accept diff --git a/core/modules/path/path.admin.inc b/core/modules/path/path.admin.inc index b03f8d6..b973c15 100644 --- a/core/modules/path/path.admin.inc +++ b/core/modules/path/path.admin.inc @@ -19,7 +19,7 @@ function path_admin_overview($keys = NULL) { // Enable language column if language.module is enabled or if we have any // alias with a language. $alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE langcode <> :langcode', 0, 1, array(':langcode' => Language::LANGCODE_NOT_SPECIFIED))->fetchField(); - $multilanguage = (module_exists('language') || $alias_exists); + $multilanguage = (Drupal::moduleHandler()->moduleExists('language') || $alias_exists); $header = array(); $header[] = array('data' => t('Alias'), 'field' => 'alias', 'sort' => 'asc'); @@ -152,7 +152,7 @@ function path_admin_form($form, &$form_state, $path = array('source' => '', 'ali ); // A hidden value unless language.module is enabled. - if (module_exists('language')) { + if (Drupal::moduleHandler()->moduleExists('language')) { $languages = language_list(); foreach ($languages as $langcode => $language) { $language_options[$langcode] = $language->name; diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/DBLogResource.php b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/DBLogResource.php index d6219f9..92a11a0 100644 --- a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/DBLogResource.php +++ b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/DBLogResource.php @@ -29,7 +29,7 @@ class DBLogResource extends ResourceBase { */ public function routes() { // Only expose routes if the dblog module is enabled. - if (module_exists('dblog')) { + if (Drupal::moduleHandler()->moduleExists('dblog')) { return parent::routes(); } return new RouteCollection(); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php index 58da4c3..473d4c7 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -53,7 +53,7 @@ function testEnableModulesLoad() { $module = 'field_test'; // Verify that the module does not exist yet. - $this->assertFalse(module_exists($module), "$module module not found."); + $this->assertFalse(Drupal::moduleHandler()->moduleExists($module), "$module module not found."); $list = array_keys(\Drupal::moduleHandler()->getModuleList()); $this->assertFalse(in_array($module, $list), "$module module not found in the extension handler's module list."); $list = module_implements('permission'); @@ -63,7 +63,7 @@ function testEnableModulesLoad() { $this->enableModules(array($module)); // Verify that the module exists. - $this->assertTrue(module_exists($module), "$module module found."); + $this->assertTrue(Drupal::moduleHandler()->moduleExists($module), "$module module found."); $list = array_keys(\Drupal::moduleHandler()->getModuleList()); $this->assertTrue(in_array($module, $list), "$module module found in the extension handler's module list."); $list = module_implements('permission'); @@ -78,7 +78,7 @@ function testEnableModulesInstall() { $table = 'node'; // Verify that the module does not exist yet. - $this->assertFalse(module_exists($module), "$module module not found."); + $this->assertFalse(Drupal::moduleHandler()->moduleExists($module), "$module module not found."); $list = array_keys(\Drupal::moduleHandler()->getModuleList()); $this->assertFalse(in_array($module, $list), "$module module not found in the extension handler's module list."); $list = module_implements('permission'); @@ -92,7 +92,7 @@ function testEnableModulesInstall() { module_enable(array($module)); // Verify that the enabled module exists. - $this->assertTrue(module_exists($module), "$module module found."); + $this->assertTrue(Drupal::moduleHandler()->moduleExists($module), "$module module found."); $list = array_keys(\Drupal::moduleHandler()->getModuleList()); $this->assertTrue(in_array($module, $list), "$module module found in the extension handler's module list."); $list = module_implements('permission'); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index f0aa5fd..234277b 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -254,7 +254,7 @@ protected function drupalCreateNode(array $settings = array()) { ); // Add in comment settings for nodes. - if (module_exists('comment')) { + if (Drupal::moduleHandler()->moduleExists('comment')) { $settings += array( 'comment' => COMMENT_NODE_OPEN, ); diff --git a/core/modules/syslog/syslog.module b/core/modules/syslog/syslog.module index fe781c3..22e2719 100644 --- a/core/modules/syslog/syslog.module +++ b/core/modules/syslog/syslog.module @@ -46,7 +46,7 @@ function syslog_help($path, $arg) { */ function syslog_form_system_logging_settings_alter(&$form, &$form_state) { $config = config('syslog.settings'); - $help = module_exists('help') ? ' ' . l(t('More information'), 'admin/help/syslog') . '.' : NULL; + $help = Drupal::moduleHandler()->moduleExists('help') ? ' ' . l(t('More information'), 'admin/help/syslog') . '.' : NULL; $form['syslog_identity'] = array( '#type' => 'textfield', '#title' => t('Syslog identity'), diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php index a6322b0..279de9e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php @@ -157,10 +157,10 @@ function testDependencyResolution() { // are not already enabled. (If they were, the tests below would not work // correctly.) module_enable(array('module_test'), FALSE); - $this->assertTrue(module_exists('module_test'), 'Test module is enabled.'); - $this->assertFalse(module_exists('forum'), 'Forum module is disabled.'); - $this->assertFalse(module_exists('ban'), 'Ban module is disabled.'); - $this->assertFalse(module_exists('php'), 'PHP module is disabled.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('module_test'), 'Test module is enabled.'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('forum'), 'Forum module is disabled.'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('ban'), 'Ban module is disabled.'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('php'), 'PHP module is disabled.'); // First, create a fake missing dependency. Forum depends on ban, which // depends on a made-up module, foo. Nothing should be installed. @@ -168,7 +168,7 @@ function testDependencyResolution() { drupal_static_reset('system_rebuild_module_data'); $result = module_enable(array('forum')); $this->assertFalse($result, 'module_enable() returns FALSE if dependencies are missing.'); - $this->assertFalse(module_exists('forum'), 'module_enable() aborts if dependencies are missing.'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('forum'), 'module_enable() aborts if dependencies are missing.'); // Now, fix the missing dependency. Forum module depends on ban, but ban // depends on the PHP module. module_enable() should work. @@ -177,9 +177,9 @@ function testDependencyResolution() { $result = module_enable(array('forum')); $this->assertTrue($result, 'module_enable() returns the correct value.'); // Verify that the fake dependency chain was installed. - $this->assertTrue(module_exists('ban') && module_exists('php'), 'Dependency chain was installed by module_enable().'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('ban') && Drupal::moduleHandler()->moduleExists('php'), 'Dependency chain was installed by module_enable().'); // Verify that the original module was installed. - $this->assertTrue(module_exists('forum'), 'Module installation with unlisted dependencies succeeded.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('forum'), 'Module installation with unlisted dependencies succeeded.'); // Finally, verify that the modules were enabled in the correct order. $module_order = \Drupal::state()->get('system_test.module_enable_order') ?: array(); $this->assertEqual($module_order, array('php', 'ban', 'forum'), 'Modules were enabled in the correct order by module_enable().'); @@ -187,8 +187,8 @@ function testDependencyResolution() { // Now, disable the PHP module. Both forum and ban should be disabled as // well, in the correct order. module_disable(array('php')); - $this->assertTrue(!module_exists('forum') && !module_exists('ban'), 'Depedency chain was disabled by module_disable().'); - $this->assertFalse(module_exists('php'), 'Disabling a module with unlisted dependents succeeded.'); + $this->assertTrue(!Drupal::moduleHandler()->moduleExists('forum') && !Drupal::moduleHandler()->moduleExists('ban'), 'Depedency chain was disabled by module_disable().'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('php'), 'Disabling a module with unlisted dependents succeeded.'); $disabled_modules = \Drupal::state()->get('module_test.disable_order') ?: array(); $this->assertEqual($disabled_modules, array('forum', 'ban', 'php'), 'Modules were disabled in the correct order by module_disable().'); @@ -198,9 +198,9 @@ function testDependencyResolution() { $profile = drupal_get_profile(); $info = install_profile_info($profile); $this->assertTrue(in_array('comment', $info['dependencies']), 'Comment module is listed as a dependency of the installation profile.'); - $this->assertTrue(module_exists('comment'), 'Comment module is enabled.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('comment'), 'Comment module is enabled.'); module_disable(array('comment')); - $this->assertFalse(module_exists('comment'), 'Comment module was disabled.'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('comment'), 'Comment module was disabled.'); $disabled_modules = \Drupal::state()->get('module_test.disable_order') ?: array(); $this->assertTrue(in_array('comment', $disabled_modules), 'Comment module is in the list of disabled modules.'); $this->assertFalse(in_array($profile, $disabled_modules), 'The installation profile is not in the list of disabled modules.'); @@ -243,9 +243,9 @@ function testDependencyResolution() { $result = module_enable(array('forum')); $this->assertTrue($result, 'module_enable() returns the correct value.'); // Verify that the fake dependency chain was installed. - $this->assertTrue(module_exists('ban') && module_exists('php'), 'Dependency chain was installed by module_enable().'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('ban') && Drupal::moduleHandler()->moduleExists('php'), 'Dependency chain was installed by module_enable().'); // Verify that the original module was installed. - $this->assertTrue(module_exists('forum'), 'Module installation with version dependencies succeeded.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('forum'), 'Module installation with version dependencies succeeded.'); // Finally, verify that the modules were enabled in the correct order. $enable_order = \Drupal::state()->get('system_test.module_enable_order') ?: array(); $php_position = array_search('php', $enable_order); diff --git a/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php b/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php index aa2e1ae..f67b1aa 100644 --- a/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/System/InfoAlterTest.php @@ -32,7 +32,7 @@ function testSystemInfoAlter() { // Enable seven and the test module. theme_enable(array('seven')); module_enable(array('module_test'), FALSE); - $this->assertTrue(module_exists('module_test'), 'Test module is enabled.'); + $this->assertTrue(Drupal::moduleHandler()->moduleExists('module_test'), 'Test module is enabled.'); // Verify that the rebuilt and altered theme info is returned. $info = system_get_info('theme', 'seven'); @@ -47,7 +47,7 @@ function testSystemInfoAlter() { // Disable the module and verify that rebuilt .info.yml does not contain it. module_disable(array('module_test'), FALSE); - $this->assertFalse(module_exists('module_test'), 'Test module is disabled.'); + $this->assertFalse(Drupal::moduleHandler()->moduleExists('module_test'), 'Test module is disabled.'); $info = system_get_info('theme', 'seven'); $this->assertFalse(isset($info['regions']['test_region']), 'Altered theme info was not returned by system_get_info().'); diff --git a/core/modules/system/system.install b/core/modules/system/system.install index d246507..9c2fed4 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -503,7 +503,7 @@ function system_requirements($phase) { if ($phase == 'runtime') { // Check for update status module. - if (!module_exists('update')) { + if (!Drupal::moduleHandler()->moduleExists('update')) { $requirements['update status'] = array( 'value' => t('Not enabled'), 'severity' => REQUIREMENT_WARNING, diff --git a/core/modules/system/system.module b/core/modules/system/system.module index e771d4e..709fe64 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -103,7 +103,7 @@ function system_help($path, $arg) { return '

    ' . t('These options control the default display settings for your entire site, across all themes. Unless they have been overridden by a specific theme, these settings will be used.') . '

    '; case 'admin/modules': $output = '

    ' . t('Download additional contributed modules to extend Drupal\'s functionality.', array('@modules' => 'http://drupal.org/project/modules')) . '

    '; - if (module_exists('update')) { + if (Drupal::moduleHandler()->moduleExists('update')) { if (update_manager_access()) { $output .= '

    ' . t('Regularly review and install available updates to maintain a secure and current site. Always run the update script each time a module is updated.', array('@update-php' => $base_url . '/core/update.php', '@updates' => url('admin/reports/updates'))) . '

    '; } @@ -948,7 +948,7 @@ function system_menu() { ); // Localize date formats. - if (module_exists('language')) { + if (Drupal::moduleHandler()->moduleExists('language')) { $items['admin/config/regional/date-time/locale'] = array( 'title' => 'Localize', 'description' => 'Configure date formats for each locale', diff --git a/core/modules/system/tests/modules/entity_test/entity_test.views.inc b/core/modules/system/tests/modules/entity_test/entity_test.views.inc index 5e3975b..3e192a7 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.views.inc +++ b/core/modules/system/tests/modules/entity_test/entity_test.views.inc @@ -55,7 +55,7 @@ function entity_test_views_data() { ), ); - if (module_exists('langcode')) { + if (Drupal::moduleHandler()->moduleExists('langcode')) { $data['entity_test']['langcode'] = array( 'title' => t('Language'), 'help' => t('The {language}.langcode of the original variant of this test entity.'), diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module index cb56e2b..fcf4430 100644 --- a/core/modules/system/tests/modules/form_test/form_test.module +++ b/core/modules/system/tests/modules/form_test/form_test.module @@ -277,7 +277,7 @@ function form_test_menu() { 'type' => MENU_CALLBACK, ); - if (module_exists('node')) { + if (Drupal::moduleHandler()->moduleExists('node')) { $items['form-test/two-instances-of-same-form'] = array( 'title' => 'AJAX test with two form instances', 'page callback' => 'form_test_two_instances', diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php index db8c145..dd26825 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php @@ -57,7 +57,7 @@ public function form(array $form, array &$form_state) { '#languages' => Language::STATE_ALL, '#default_value' => $vocabulary->langcode, ); - if (module_exists('language')) { + if (Drupal::moduleHandler()->moduleExists('language')) { $form['default_terms_language'] = array( '#type' => 'details', '#title' => t('Terms language'), @@ -91,14 +91,14 @@ protected function actions(array $form, array &$form_state) { array_unshift($actions['delete']['#submit'], array($this, 'submit')); // Add the language configuration submit handler. This is needed because // the submit button has custom submit handlers. - if (module_exists('language')) { + if (Drupal::moduleHandler()->moduleExists('language')) { array_unshift($actions['submit']['#submit'],'language_configuration_element_submit'); array_unshift($actions['submit']['#submit'], array($this, 'languageConfigurationSubmit')); } // We cannot leverage the regular submit handler definition because we // have button-specific ones here. Hence we need to explicitly set it for // the submit action, otherwise it would be ignored. - if (module_exists('content_translation')) { + if (Drupal::moduleHandler()->moduleExists('content_translation')) { array_unshift($actions['submit']['#submit'], 'content_translation_language_configuration_element_submit'); } return $actions; diff --git a/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc index eabd7f4..5700bf2 100644 --- a/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -89,7 +89,7 @@ function tracker_page($account = NULL, $set_title = FALSE) { ); // Adds extra RDFa markup to the $row array if the RDF module is enabled. - if (module_exists('rdf')) { + if (Drupal::moduleHandler()->moduleExists('rdf')) { $mapping = rdf_get_mapping('node', $node->type); // Adds RDFa markup to the title of the node. Because the RDFa markup is // added to the td tag which might contain HTML code, we specify an diff --git a/core/modules/user/user.install b/core/modules/user/user.install index 871c18d..112a722 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -612,7 +612,7 @@ function user_update_8011() { // User pictures can only be migrated to the new user picture image field // if Image module is installed. - if (!module_exists('image')) { + if (!Drupal::moduleHandler()->moduleExists('image')) { $old_schema = module_enable(array('image')); if ($old_schema['image'] == SCHEMA_UNINSTALLED) { // Install image.module with schema version 8002 as a previous version diff --git a/core/scripts/generate-d7-content.sh b/core/scripts/generate-d7-content.sh index 87ec22a..8b75c1b 100644 --- a/core/scripts/generate-d7-content.sh +++ b/core/scripts/generate-d7-content.sh @@ -171,7 +171,7 @@ else if ($i < 24) { $node->type = 'story'; } - else if (module_exists('blog')) { + else if (Drupal::moduleHandler()->moduleExists('blog')) { $node->type = 'blog'; } $node->sticky = 0; diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 49b1a44..6d8a72a 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -31,7 +31,7 @@ drupal_bootstrap(DRUPAL_BOOTSTRAP_CODE); simpletest_classloader_register(); -if (!module_exists('simpletest')) { +if (!Drupal::moduleHandler()->moduleExists('simpletest')) { simpletest_script_print_error("The simpletest module must be enabled before this script can run."); exit; } diff --git a/core/update.php b/core/update.php index fba6b86..5a19b92 100644 --- a/core/update.php +++ b/core/update.php @@ -201,7 +201,7 @@ function update_results_page() { update_task_list(); // Report end result. - if (module_exists('dblog') && user_access('access site reports')) { + if (Drupal::moduleHandler()->moduleExists('dblog') && user_access('access site reports')) { $log_message = ' All errors have been logged.'; } else { @@ -215,7 +215,7 @@ function update_results_page() { $last = reset($_SESSION['updates_remaining']); list($module, $version) = array_pop($last); $output = '

    The update process was aborted prematurely while running update #' . $version . ' in ' . $module . '.module.' . $log_message; - if (module_exists('dblog')) { + if (Drupal::moduleHandler()->moduleExists('dblog')) { $output .= ' You may need to check the watchdog database table manually.'; } $output .= '

    ';