diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 0d4af60..248118f 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2456,7 +2456,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 c64e58e..8cb65a4 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 3ee24ab..ac5624a 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -1629,7 +1629,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 0f481ad..f4d3ebd 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -59,7 +59,7 @@ function block_help($path, $arg) { $output .= '
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..19e5384 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 100c19c..30f1c52 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 8928f4f..ebf9df6 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..74077be 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 312ebb5..621eb37 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 e929de6..8f931df 100644
--- a/core/modules/field/field.module
+++ b/core/modules/field/field.module
@@ -218,7 +218,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 0171fb2..a71eeec 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..f279090 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 36821c0..4b32f63 100644
--- a/core/modules/help/help.module
+++ b/core/modules/help/help.module
@@ -41,7 +41,7 @@ function help_help($path, $arg) {
$output .= '' . 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..cd22b77 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 9419999..bd751db 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 @@ -33,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 d1a574a..638f971 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 @@ -31,7 +31,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'); } } @@ -66,7 +66,7 @@ function render_link($data, ResultRow $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 5a6d53a..4c9c3ec 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 05c6fb8..36f2191 100644 --- a/core/modules/overlay/overlay.module +++ b/core/modules/overlay/overlay.module @@ -503,7 +503,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..f1296c0 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 1171d1e..6871048 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 = \Drupal::moduleHandler()->getImplementations('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 = \Drupal::moduleHandler()->getImplementations('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 = \Drupal::moduleHandler()->getImplementations('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 = \Drupal::moduleHandler()->getImplementations('permission'); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index a99e3d0..57af52d 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -256,7 +256,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 d2d65bc..c89158a 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..f6f15c4 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 6c170da..e1c9339 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -502,7 +502,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 4a7cdf4..32592cb 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -104,7 +104,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'))) . '
'; } @@ -942,7 +942,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 762d7fc..6523595 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 3fb3125..f5bc0b7 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyFormController.php @@ -43,17 +43,17 @@ public function form(array $form, array &$form_state) { '#default_value' => $vocabulary->description, ); - // $form['langcode'] is not wrapped in an if (module_exists('language')) - // check because the language_select form element works also without the - // language module being installed. - // http://drupal.org/node/1749954 documents the new element. + // $form['langcode'] is not wrapped in an + // if (Drupal::moduleHandler()->moduleExists('language')) check because the + // language_select form element works also without the language module being + // installed. http://drupal.org/node/1749954 documents the new element. $form['langcode'] = array( '#type' => 'language_select', '#title' => t('Vocabulary language'), '#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'), @@ -86,14 +86,14 @@ protected function actions(array $form, array &$form_state) { $actions = parent::actions($form, $form_state); // 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 cf2f51a..69fac11 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 8608f97..35e3051 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 .= '