Commit 37422573 authored by alexpott's avatar alexpott

Issue #2053489 followup by tim.plunkett, klausi: Standardize on \Drupal throughout core.

parent 4351d67f
......@@ -995,7 +995,7 @@ function install_base_system(&$install_state) {
// Enable the user module so that sessions can be recorded during the
// upcoming bootstrap step.
Drupal::moduleHandler()->install(array('user'), FALSE);
\Drupal::moduleHandler()->install(array('user'), FALSE);
// Save the list of other modules to install for the upcoming tasks.
// variable_set() can be used now that system.module is installed.
......@@ -2037,7 +2037,7 @@ function _install_module_batch($module, $module_name, &$context) {
// loaded by drupal_bootstrap in subsequent batch requests, and other
// modules possibly depending on it can safely perform their installation
// steps.
Drupal::moduleHandler()->install(array($module), FALSE);
\Drupal::moduleHandler()->install(array($module), FALSE);
$context['results'][] = $module;
$context['message'] = t('Installed %module module.', array('%module' => $module_name));
}
......@@ -2529,7 +2529,7 @@ function install_configure_form_submit($form, &$form_state) {
// Enable update.module if this option was selected.
if ($form_state['values']['update_status_module'][1]) {
Drupal::moduleHandler()->install(array('file', 'update'), FALSE);
\Drupal::moduleHandler()->install(array('file', 'update'), FALSE);
// Add the site maintenance account's email address to the list of
// addresses to be notified when updates are available, if selected.
......
......@@ -1743,7 +1743,7 @@ function theme_menu_local_task($variables) {
$a_tag = l($link_text, $link['href'], $link['localized_options']);
}
else {
$a_tag = Drupal::l($link_text, $link['route_name'], $link['route_parameters'], $link['localized_options']);
$a_tag = \Drupal::l($link_text, $link['route_name'], $link['route_parameters'], $link['localized_options']);
}
return '<li' . (!empty($variables['element']['#active']) ? ' class="active"' : '') . '>' . $a_tag . '</li>';
......@@ -1967,9 +1967,9 @@ function menu_local_tasks($level = 0) {
$data['tabs'] = array();
$data['actions'] = array();
$route_name = Drupal::request()->attributes->get(RouteObjectInterface::ROUTE_NAME);
$route_name = \Drupal::request()->attributes->get(RouteObjectInterface::ROUTE_NAME);
if (!empty($route_name)) {
$manager = Drupal::service('plugin.manager.menu.local_task');
$manager = \Drupal::service('plugin.manager.menu.local_task');
$local_tasks = $manager->getTasksBuild($route_name);
foreach ($local_tasks as $level => $items) {
$data['tabs'][$level] = empty($data['tabs'][$level]) ? $items : array_merge($data['tabs'][$level], $items);
......
......@@ -77,7 +77,7 @@ function drupal_theme_access($theme) {
if (is_object($theme)) {
$theme = $theme->name;
}
return Drupal::service('access_check.theme')->checkAccess($theme);
return \Drupal::service('access_check.theme')->checkAccess($theme);
}
/**
......
......@@ -485,7 +485,7 @@ function update_prepare_stored_includes() {
*/
function update_prepare_d8_language() {
if (db_table_exists('languages')) {
Drupal::moduleHandler()->install(array('language'));
\Drupal::moduleHandler()->install(array('language'));
$languages = db_select('languages', 'l')
->fields('l')
......@@ -677,7 +677,7 @@ function update_fix_d8_requirements() {
// Make sure that file.module is enabled as it is required for the user
// picture upgrade path.
Drupal::moduleHandler()->install(array('file'));
\Drupal::moduleHandler()->install(array('file'));
$schema = array(
'description' => 'Generic key/value storage table with an expiration.',
......@@ -721,7 +721,7 @@ function update_fix_d8_requirements() {
// views configurations.
// Like any other module APIs and services, Views' services are not available
// in update.php. Existing listings are migrated into configuration, using
// the limited standard tools of raw database queries and Drupal::config().
// the limited standard tools of raw database queries and \Drupal::config().
\Drupal::moduleHandler()->install(array('views'));
update_variable_set('update_d8_requirements', TRUE);
......
......@@ -184,7 +184,7 @@ function block_update_8005() {
* Enable the Custom Block module.
*/
function block_update_8006() {
Drupal::moduleHandler()->install(array('custom_block'));
\Drupal::moduleHandler()->install(array('custom_block'));
}
/**
......
......@@ -163,7 +163,7 @@ function entity_entity_bundle_delete($entity_type, $bundle) {
function entity_module_preuninstall($module) {
// Clean up all entity bundles (including field instances) of every entity
// type provided by the module that is being uninstalled.
foreach (Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) {
foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) {
if ($entity_info['module'] == $module) {
foreach (array_keys(entity_get_bundles($entity_type)) as $bundle) {
entity_invoke_bundle_hook('delete', $entity_type, $bundle);
......
......@@ -548,7 +548,7 @@ function forum_form_node_form_alter(&$form, &$form_state, $form_id) {
// If there is no default forum already selected, try to get the forum
// ID from the URL (e.g., if we are on a page like node/add/forum/2, we
// expect "2" to be the ID of the forum that was requested).
$requested_forum_id = Drupal::request()->query->get('forum_id');
$requested_forum_id = \Drupal::request()->query->get('forum_id');
$widget['#default_value'] = is_numeric($requested_forum_id) ? $requested_forum_id : '';
}
}
......
......@@ -12,7 +12,7 @@
*/
function menu_install() {
// Add a link for each custom menu.
Drupal::service('router.builder')->rebuild();
\Drupal::service('router.builder')->rebuild();
menu_router_rebuild();
$system_link = entity_load_multiple_by_properties('menu_link', array('link_path' => 'admin/structure/menu', 'module' => 'system'));
$system_link = reset($system_link);
......@@ -30,7 +30,7 @@ function menu_install() {
$link->link_title = $menu->label();
$link->link_path = 'admin/structure/menu/manage/' . $menu->id();
$query = Drupal::entityQuery('menu_link')
$query = \Drupal::entityQuery('menu_link')
->condition('link_path', $link->link_path)
->condition('plid', $link->plid);
$result = $query->execute();
......
......@@ -499,7 +499,7 @@ function menu_form_node_form_alter(&$form, $form_state) {
$form['menu'] = array(
'#type' => 'details',
'#title' => t('Menu settings'),
'#access' => Drupal::currentUser()->hasPermission('administer menu'),
'#access' => \Drupal::currentUser()->hasPermission('administer menu'),
'#collapsed' => !$link['link_title'],
'#group' => 'advanced',
'#attached' => array(
......
......@@ -696,7 +696,7 @@ function node_update_8011() {
*/
function node_update_8012() {
// Enable the history module without re-installing the schema.
Drupal::moduleHandler()->install(array('history'));
\Drupal::moduleHandler()->install(array('history'));
}
/**
......
......@@ -58,7 +58,7 @@ function statistics_node_view(EntityInterface $node, EntityDisplay $display, $vi
}
if ($view_mode != 'rss') {
if (Drupal::currentUser()->hasPermission('view post access counter')) {
if (\Drupal::currentUser()->hasPermission('view post access counter')) {
$statistics = statistics_get($node->id());
if ($statistics) {
$links['statistics_counter']['title'] = format_plural($statistics['totalcount'], '1 view', '@count views');
......
......@@ -1550,7 +1550,7 @@ function system_update_8020() {
->condition('aid', 'system_block_ip_action')
->execute();
// Enable the new Ban module.
Drupal::moduleHandler()->install(array('ban'));
\Drupal::moduleHandler()->install(array('ban'));
}
else {
// Drop old table.
......@@ -1563,7 +1563,7 @@ function system_update_8020() {
*/
function system_update_8021() {
// Enable the module without re-installing the schema.
Drupal::moduleHandler()->install(array('action'));
\Drupal::moduleHandler()->install(array('action'));
// Rename former System module actions.
$map = array(
'system_message_action' => 'action_message_action',
......@@ -1864,7 +1864,7 @@ function system_update_8041() {
* Enable the new Entity module.
*/
function system_update_8042() {
Drupal::moduleHandler()->install(array('entity'));
\Drupal::moduleHandler()->install(array('entity'));
}
/**
......@@ -1978,7 +1978,7 @@ function system_update_8047() {
*/
function system_update_8048() {
// Enable the module without re-installing the schema.
Drupal::moduleHandler()->install(array('menu_link'));
\Drupal::moduleHandler()->install(array('menu_link'));
// Add the langcode column if it doesn't exist.
if (!db_field_exists('menu_inks', 'langcode')) {
......
......@@ -263,12 +263,12 @@ function system_test_authorize_init_page($page_title) {
* Implements hook_module_preinstall().
*/
function system_test_module_preinstall($module) {
Drupal::state()->set('system_test_preinstall_module', $module);
\Drupal::state()->set('system_test_preinstall_module', $module);
}
/**
* Implements hook_module_preuninstall().
*/
function system_test_module_preuninstall($module) {
Drupal::state()->set('system_test_preuninstall_module', $module);
\Drupal::state()->set('system_test_preuninstall_module', $module);
}
......@@ -18,7 +18,7 @@
*/
function toolbar_update_8000() {
// Enable the modules without re-installing the schema.
Drupal::moduleHandler()->install(array('breakpoint'));
\Drupal::moduleHandler()->install(array('breakpoint'));
}
/**
......
......@@ -614,7 +614,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')) {
$old_schema = Drupal::moduleHandler()->install(array('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
// would have to create tables that would be removed again.
......
......@@ -44,7 +44,7 @@
ENDOFHEADER;
foreach (Drupal::moduleHandler()->getModuleList() as $module => $filename) {
foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) {
$output .= " * - $module\n";
}
$output .= " */\n\n";
......
......@@ -45,7 +45,7 @@
ENDOFHEADER;
foreach (Drupal::moduleHandler()->getModuleList() as $module => $filename) {
foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) {
$output .= " * - $module\n";
}
$output .= " */\n\n";
......
......@@ -43,7 +43,7 @@ function bartik_preprocess_page(&$variables) {
$variables['secondary_menu']['#attributes']['class'] = array('links', 'inline', 'clearfix');
}
$site_config = Drupal::config('system.site');
$site_config = \Drupal::config('system.site');
// Always print the site name and slogan, but if they are toggled off, we'll
// just hide them visually.
$variables['hide_site_name'] = theme_get_setting('features.name') ? FALSE : TRUE;
......@@ -87,7 +87,7 @@ function bartik_preprocess_maintenance_page(&$variables) {
drupal_add_css(drupal_get_path('theme', 'bartik') . '/css/maintenance-page.css');
$variables['styles'] = drupal_get_css();
$site_config = Drupal::config('system.site');
$site_config = \Drupal::config('system.site');
// Always print the site name and slogan, but if they are toggled off, we'll
// just hide them visually.
$variables['hide_site_name'] = theme_get_setting('features.name') ? FALSE : TRUE;
......
......@@ -14,7 +14,7 @@ function seven_library_info() {
$path = drupal_get_path('theme', 'seven');
$libraries['install-page'] = array(
'version' => Drupal::VERSION,
'version' => \Drupal::VERSION,
'js' => array(
$path . '/js/mobile.install.js' => array(
'group' => JS_THEME,
......@@ -99,7 +99,7 @@ function seven_custom_block_add_list($variables) {
$content .= '<div class="description">' . filter_xss_admin($type['description']) . '</div>';
$options = $type['localized_options'];
$options['html'] = TRUE;
$output .= Drupal::l($content, 'custom_block.add_form', array('custom_block_type' => $id), $options);
$output .= \Drupal::l($content, 'custom_block.add_form', array('custom_block_type' => $id), $options);
$output .= '</li>';
}
$output .= '</ul>';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment