8.0.x
Nathaniel Catchpole 2013-10-16 12:19:18 +01:00
parent c8c891c920
commit cc84f3903c
24 changed files with 29 additions and 29 deletions

View File

@ -2428,7 +2428,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');

View File

@ -2819,7 +2819,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')) {
// The Menu link module may not be available during install, so rebuild
// when possible.
return;

View File

@ -1636,7 +1636,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');

View File

@ -45,7 +45,7 @@ function block_help($path, $arg) {
$output .= '<dd>' . t('When working with blocks, remember that all themes do <em>not</em> implement the same regions, or display regions in the same way. Blocks are positioned on a per-theme basis. Users with the <em>Administer blocks</em> permission can disable blocks. Disabled blocks are listed on the <a href="@blocks">Blocks administration page</a>, but are not displayed in any region.', array('@block' => 'http://drupal.org/documentation/modules/block', '@blocks' => url('admin/structure/block'))) . '</dd>';
$output .= '<dt>' . t('Controlling visibility') . '</dt>';
$output .= '<dd>' . t('Blocks can be configured to be visible only on certain pages, only to users of certain roles, or only on pages displaying certain <a href="@content-type">content types</a>. 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'))) . '</dd>';
if (module_exists('custom_block')) {
if (\Drupal::moduleHandler()->moduleExists('custom_block')) {
$output .= '<dt>' . t('Creating custom blocks') . '</dt>';
$output .= '<dd>' . t('Users with the <em>Administer blocks</em> permission can add custom blocks, which are then listed on the <a href="@blocks">Blocks administration page</a>. Once created, custom blocks behave just like default and module-generated blocks.', array('@blocks' => url('admin/structure/block'))) . '</dd>';
}

View File

@ -172,7 +172,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;
}
}

View File

@ -23,7 +23,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);
@ -270,7 +270,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);
}

View File

@ -61,7 +61,7 @@ function dblog_menu() {
'route_name' => 'dblog.event',
);
if (module_exists('search')) {
if (\Drupal::moduleHandler()->moduleExists('search')) {
$items['admin/reports/search'] = array(
'title' => 'Top search phrases',
'description' => 'View most popular search phrases.',

View File

@ -43,7 +43,7 @@ use Drupal\field\FieldUpdateForbiddenException;
*/
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) {

View File

@ -176,7 +176,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 <a href="@fields-page">Field list</a>', array('@fields-page' => url('admin/reports/fields')));
}
else {

View File

@ -37,7 +37,7 @@ function help_help($path, $arg) {
$output .= '<li>' . t('<strong>Enable additional functionality</strong> Next, visit the <a href="@modules">module list</a> and enable features which suit your specific needs. You can find additional modules in the <a href="@download_modules">Drupal modules download section</a>.', array('@modules' => url('admin/modules'), '@download_modules' => 'http://drupal.org/project/modules')) . '</li>';
$output .= '<li>' . t('<strong>Customize your website design</strong> To change the "look and feel" of your website, visit the <a href="@themes">themes section</a>. You may choose from one of the included themes or download additional themes from the <a href="@download_themes">Drupal themes download section</a>.', array('@themes' => url('admin/appearance'), '@download_themes' => 'http://drupal.org/project/themes')) . '</li>';
// Display a link to the create content page if Node module is enabled.
if (module_exists('node')) {
if (\Drupal::moduleHandler()->moduleExists('node')) {
$output .= '<li>' . t('<strong>Start posting content</strong> Finally, you can <a href="@content">add new content</a> for your website.', array('@content' => url('node/add'))) . '</li>';
}
$output .= '</ol>';

View File

@ -273,7 +273,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)));

View File

@ -45,7 +45,7 @@ function menu_help($path, $arg) {
case 'admin/structure/menu/add':
return '<p>' . t('You can enable the newly-created block for this menu on the <a href="@blocks">Blocks administration page</a>.', array('@blocks' => url('admin/structure/block'))) . '</p>';
}
if ($path == 'admin/structure/menu' && module_exists('block')) {
if ($path == 'admin/structure/menu' && \Drupal::moduleHandler()->moduleExists('block')) {
return '<p>' . t('Each menu has a corresponding block that is managed on the <a href="@blocks">Blocks administration page</a>.', array('@blocks' => url('admin/structure/block'))) . '</p>';
}
}

View File

@ -279,7 +279,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])) {
@ -443,7 +443,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) {

View File

@ -648,7 +648,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');
}

View File

@ -501,7 +501,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 (\Drupal::config('language.negotiation')->get('url.source') == LANGUAGE_NEGOTIATION_URL_PREFIX) {
// Skip the empty string indicating the default language. We always accept

View File

@ -21,7 +21,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');
@ -157,7 +157,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;

View File

@ -505,7 +505,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,

View File

@ -103,7 +103,7 @@ function system_help($path, $arg) {
return '<p>' . 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.') . '</p>';
case 'admin/modules':
$output = '<p>' . t('Download additional <a href="@modules">contributed modules</a> to extend Drupal\'s functionality.', array('@modules' => 'http://drupal.org/project/modules')) . '</p>';
if (module_exists('update')) {
if (\Drupal::moduleHandler()->moduleExists('update')) {
if (update_manager_access()) {
$output .= '<p>' . t('Regularly review and install <a href="@updates">available updates</a> to maintain a secure and current site. Always run the <a href="@update-php">update script</a> each time a module is updated.', array('@update-php' => $base_url . '/core/update.php', '@updates' => url('admin/reports/updates'))) . '</p>';
}
@ -886,7 +886,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',

View File

@ -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.'),

View File

@ -101,7 +101,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->getType());
// 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

View File

@ -608,7 +608,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 = \Drupal::moduleHandler()->install(array('image'));
if ($old_schema['image'] == SCHEMA_UNINSTALLED) {
// Install image.module with schema version 8002 as a previous version

View File

@ -171,7 +171,7 @@ for ($i = 0; $i < 36; $i++) {
else if ($i < 24) {
$node->type = 'story';
}
else if (module_exists('blog')) {
else if (\Drupal::moduleHandler()->moduleExists('blog')) {
$node->type = 'blog';
}
$node->sticky = 0;

View File

@ -35,7 +35,7 @@ else {
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;
}

View File

@ -203,7 +203,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 <a href="' . base_path() . '?q=admin/reports/dblog">logged</a>.';
}
else {
@ -217,7 +217,7 @@ function update_results_page() {
$last = reset($_SESSION['updates_remaining']);
list($module, $version) = array_pop($last);
$output = '<p class="error">The update process was aborted prematurely while running <strong>update #' . $version . ' in ' . $module . '.module</strong>.' . $log_message;
if (module_exists('dblog')) {
if (\Drupal::moduleHandler()->moduleExists('dblog')) {
$output .= ' You may need to check the <code>watchdog</code> database table manually.';
}
$output .= '</p>';