diff --git a/core/authorize.php b/core/authorize.php index ae53628..ecb7e22 100644 --- a/core/authorize.php +++ b/core/authorize.php @@ -74,7 +74,7 @@ function authorize_access_allowed() { drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); $request = Request::createFromGlobals(); -Drupal::getContainer()->set('request', $request); +\Drupal::getContainer()->set('request', $request); // This must go after drupal_bootstrap(), which unsets globals! global $conf; @@ -83,9 +83,9 @@ function authorize_access_allowed() { // display errors via the maintenance theme. $module_list['system'] = 'core/modules/system/system.module'; $module_list['user'] = 'core/modules/user/user.module'; -Drupal::moduleHandler()->setModuleList($module_list); -Drupal::moduleHandler()->load('system'); -Drupal::moduleHandler()->load('user'); +\Drupal::moduleHandler()->setModuleList($module_list); +\Drupal::moduleHandler()->load('system'); +\Drupal::moduleHandler()->load('user'); // Initialize the language system. drupal_language_initialize(); diff --git a/core/includes/ajax.inc b/core/includes/ajax.inc index ac1d4cb..bb77798 100644 --- a/core/includes/ajax.inc +++ b/core/includes/ajax.inc @@ -332,7 +332,7 @@ function ajax_base_page_theme() { // to see the default theme, token validation isn't required for that, and // bypassing it allows most use-cases to work even when accessed from the // page cache. - if ($theme === Drupal::config('system.theme')->get('default') || drupal_valid_token($token, $theme)) { + if ($theme === \Drupal::config('system.theme')->get('default') || drupal_valid_token($token, $theme)) { return $theme; } } @@ -368,7 +368,7 @@ function ajax_prepare_response($page_callback_result) { break; case MENU_SITE_OFFLINE: - $commands[] = ajax_command_alert(filter_xss_admin(t(Drupal::config('system.maintenance')->get('message'), array('@site' => Drupal::config('system.site')->get('name'))))); + $commands[] = ajax_command_alert(filter_xss_admin(t(\Drupal::config('system.maintenance')->get('message'), array('@site' => \Drupal::config('system.site')->get('name'))))); break; } } diff --git a/core/includes/authorize.inc b/core/includes/authorize.inc index 8b6ef01..481fd30 100644 --- a/core/includes/authorize.inc +++ b/core/includes/authorize.inc @@ -27,7 +27,7 @@ function authorize_filetransfer_form($form, &$form_state) { } $available_backends = $_SESSION['authorize_filetransfer_info']; - if (!Drupal::request()->isSecure()) { + if (!\Drupal::request()->isSecure()) { $form['information']['https_warning'] = array( '#prefix' => '
', '#markup' => t('WARNING: You are not using an encrypted connection, so your password will be sent in plain text. Learn more.', array('@https-link' => 'http://drupal.org/https-information')), @@ -39,7 +39,7 @@ function authorize_filetransfer_form($form, &$form_state) { if (isset($form_state['values']['connection_settings']['authorize_filetransfer_default'])) { $authorize_filetransfer_default = $form_state['values']['connection_settings']['authorize_filetransfer_default']; } - elseif ($authorize_filetransfer_default = Drupal::config('system.authorize')->get('filetransfer_default')); + elseif ($authorize_filetransfer_default = \Drupal::config('system.authorize')->get('filetransfer_default')); else { $authorize_filetransfer_default = key($available_backends); } @@ -138,7 +138,7 @@ function authorize_filetransfer_form($form, &$form_state) { * @see hook_filetransfer_backends() */ function _authorize_filetransfer_connection_settings($backend) { - $auth_connection_config = Drupal::config('system.authorize')->get('filetransfer_connection_settings_' . $backend); + $auth_connection_config = \Drupal::config('system.authorize')->get('filetransfer_connection_settings_' . $backend); $defaults = $auth_connection_config ? $auth_connection_config : array(); $form = array(); @@ -253,9 +253,9 @@ function authorize_filetransfer_form_submit($form, &$form_state) { } } // Set this one as the default authorize method. - Drupal::config('system.authorize')->set('filetransfer_default', $filetransfer_backend); + \Drupal::config('system.authorize')->set('filetransfer_default', $filetransfer_backend); // Save the connection settings minus the password. - Drupal::config('system.authorize')->set('filetransfer_connection_settings_' . $filetransfer_backend, $connection_settings); + \Drupal::config('system.authorize')->set('filetransfer_connection_settings_' . $filetransfer_backend, $connection_settings); $filetransfer = authorize_get_filetransfer($filetransfer_backend, $form_state['values']['connection_settings'][$filetransfer_backend]); diff --git a/core/includes/batch.inc b/core/includes/batch.inc index 889799c..14f4499 100644 --- a/core/includes/batch.inc +++ b/core/includes/batch.inc @@ -36,7 +36,7 @@ function _batch_page(Request $request) { // Retrieve the current state of the batch. if (!$batch) { - $batch = Drupal::service('batch.storage')->load($request_id); + $batch = \Drupal::service('batch.storage')->load($request_id); if (!$batch) { drupal_set_message(t('No active batch.'), 'error'); return new RedirectResponse(url('', array('absolute' => TRUE))); @@ -394,7 +394,7 @@ function _batch_finished() { // Clean up the batch table and unset the static $batch variable. if ($batch['progressive']) { - Drupal::service('batch.storage')->delete($batch['id']); + \Drupal::service('batch.storage')->delete($batch['id']); foreach ($batch['sets'] as $batch_set) { if ($queue = _batch_queue($batch_set)) { $queue->deleteQueue(); @@ -415,7 +415,7 @@ function _batch_finished() { if ($_batch['progressive']) { // Revert the 'destination' that was saved in batch_process(). if (isset($_batch['destination'])) { - Drupal::request()->query->set('destination', $_batch['destination']); + \Drupal::request()->query->set('destination', $_batch['destination']); } // Determine the target path to redirect to. @@ -463,6 +463,6 @@ function _batch_finished() { */ function _batch_shutdown() { if ($batch = batch_get()) { - Drupal::service('batch.storage')->update($batch); + \Drupal::service('batch.storage')->update($batch); } } diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index e8350cf..32f47fa 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -451,7 +451,7 @@ function config_get_config_directory($type = CONFIG_ACTIVE_DIRECTORY) { * return the expected values. * * Most other parameters do not need to be passed in, but may be necessary in - * some cases; for example, if Drupal::request()->getClientIP() + * some cases; for example, if \Drupal::request()->getClientIP() * needs to return anything but the standard localhost value ('127.0.0.1'), * the command line script should pass in the desired value via the * 'REMOTE_ADDR' key. @@ -744,17 +744,17 @@ function drupal_get_filename($type, $name, $filename = NULL) { // Verify that we have an keyvalue service before using it. This is required // because this function is called during installation. // @todo Inject database connection into KeyValueStore\DatabaseStorage. - if (($container = Drupal::getContainer()) && $container->has('keyvalue') && function_exists('db_query')) { + if (($container = \Drupal::getContainer()) && $container->has('keyvalue') && function_exists('db_query')) { if ($type == 'module') { if (empty($files[$type])) { - $files[$type] = Drupal::moduleHandler()->getModuleList(); + $files[$type] = \Drupal::moduleHandler()->getModuleList(); } if (isset($files[$type][$name])) { return $files[$type][$name]; } } try { - $file_list = Drupal::state()->get('system.' . $type . '.files'); + $file_list = \Drupal::state()->get('system.' . $type . '.files'); if ($file_list && isset($file_list[$name]) && file_exists(DRUPAL_ROOT . '/' . $file_list[$name])) { $files[$type][$name] = $file_list[$name]; } @@ -839,7 +839,7 @@ function variable_initialize($conf = array()) { else { // Cache miss. Avoid a stampede. $name = 'variable_init'; - $lock = Drupal::lock(); + $lock = \Drupal::lock(); if (!$lock->acquire($name, 1)) { // Another request is building the variable cache. // Wait, then re-run this function. @@ -953,7 +953,7 @@ function variable_del($name) { function drupal_page_cache_get_cid(Request $request) { $cid_parts = array( $request->getUri(), - Drupal::service('content_negotiation')->getContentType($request), + \Drupal::service('content_negotiation')->getContentType($request), ); return sha1(implode(':', $cid_parts)); } @@ -974,7 +974,7 @@ function drupal_page_cache_get_cid(Request $request) { */ function drupal_page_get_cache(Request $request) { if (drupal_page_is_cacheable()) { - return Drupal::cache('page')->get(drupal_page_cache_get_cid($request)); + return \Drupal::cache('page')->get(drupal_page_cache_get_cid($request)); } } @@ -1011,8 +1011,8 @@ function drupal_page_is_cacheable($allow_caching = NULL) { * TRUE if the item is loaded or has already been loaded. */ function drupal_load($type, $name) { - if ($type == 'module' && Drupal::moduleHandler()->moduleExists($name)) { - return Drupal::moduleHandler()->load($name); + if ($type == 'module' && \Drupal::moduleHandler()->moduleExists($name)) { + return \Drupal::moduleHandler()->load($name); } // Once a file is included this can't be reversed during a request so do not @@ -1211,7 +1211,7 @@ function drupal_page_header() { * response is sent. */ function drupal_serve_page_from_cache(stdClass $cache, Response $response, Request $request) { - $config = Drupal::config('system.performance'); + $config = \Drupal::config('system.performance'); // First half: we must determine if we should be returning a 304. @@ -1354,7 +1354,7 @@ function drupal_serve_page_from_cache(stdClass $cache, Response $response, Reque * @ingroup sanitization */ function t($string, array $args = array(), array $options = array()) { - return Drupal::translation()->translate($string, $args, $options); + return \Drupal::translation()->translate($string, $args, $options); } /** @@ -1542,7 +1542,7 @@ function watchdog($type, $message, array $variables = NULL, $severity = WATCHDOG ); try { - $request = Drupal::request(); + $request = \Drupal::request(); $log_entry['request_uri'] = $request->getUri(); $log_entry['referer'] = $request->headers->get('Referer', ''); $log_entry['ip'] = $request->getClientIP(); @@ -1552,7 +1552,7 @@ function watchdog($type, $message, array $variables = NULL, $severity = WATCHDOG } // Call the logging hooks to log/process the message - foreach (Drupal::moduleHandler()->getImplementations('watchdog') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('watchdog') as $module) { $function = $module . '_watchdog'; $function($log_entry); } @@ -1714,7 +1714,7 @@ function drupal_set_title($title = NULL, $output = Title::CHECK_PLAIN) { function drupal_anonymous_user() { $values = array( 'uid' => 0, - 'hostname' => Drupal::request()->getClientIP(), + 'hostname' => \Drupal::request()->getClientIP(), 'roles' => array(DRUPAL_ANONYMOUS_RID), ); return new UserSession($values); @@ -1869,7 +1869,7 @@ function drupal_handle_request($test_only = FALSE) { */ function drupal_get_user_timezone() { global $user; - $config = Drupal::config('system.date'); + $config = \Drupal::config('system.date'); if ($user && $config->get('timezone.user.configurable') && $user->isAuthenticated() && $user->getTimezone()) { return $user->getTimezone(); @@ -1966,7 +1966,7 @@ function _drupal_bootstrap_configuration() { // Load the procedural configuration system helper functions. require_once __DIR__ . '/config.inc'; - // Set the Drupal custom error handler. (requires Drupal::config()) + // Set the Drupal custom error handler. (requires \Drupal::config()) set_error_handler('_drupal_error_handler'); set_exception_handler('_drupal_exception_handler'); @@ -1985,7 +1985,7 @@ function _drupal_bootstrap_configuration() { function _drupal_bootstrap_kernel() { // Normally, index.php puts a container in the Drupal class by creating a // kernel. If there is no container yet, create one. - if (!Drupal::getContainer()) { + if (!\Drupal::getContainer()) { $kernel = new DrupalKernel('prod', drupal_classloader()); $kernel->boot(); } @@ -2004,7 +2004,7 @@ function _drupal_bootstrap_page_cache() { } else { drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE); - $config = Drupal::config('system.performance'); + $config = \Drupal::config('system.performance'); $cache_enabled = $config->get('cache.page.use_internal'); } @@ -2112,19 +2112,19 @@ function drupal_get_bootstrap_phase() { * object instances or FALSE if none exist yet. */ function drupal_container() { - return Drupal::getContainer(); + return \Drupal::getContainer(); } /** * Returns the list of enabled modules. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->getModuleList(). + * \Drupal::moduleHandler()->getModuleList(). * * @see \Drupal\Core\Extension\ModuleHandler::getModuleList() */ function module_list() { - $modules = array_keys(Drupal::moduleHandler()->getModuleList()); + $modules = array_keys(\Drupal::moduleHandler()->getModuleList()); return array_combine($modules, $modules); } @@ -2132,12 +2132,12 @@ function module_list() { * Determines which modules are implementing a hook. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->getImplementations($hook). + * \Drupal::moduleHandler()->getImplementations($hook). * * @see \Drupal\Core\Extension\ModuleHandler::getImplementations() */ function module_implements($hook) { - return Drupal::moduleHandler()->getImplementations($hook); + return \Drupal::moduleHandler()->getImplementations($hook); } /** @@ -2147,7 +2147,7 @@ function module_implements($hook) { * arguments by reference. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->invoke($module, $hook, $args = array()). + * \Drupal::moduleHandler()->invoke($module, $hook, $args = array()). * * @see drupal_alter() * @see \Drupal\Core\Extension\ModuleHandler::invoke() @@ -2156,7 +2156,7 @@ function module_invoke($module, $hook) { $args = func_get_args(); // Remove $module and $hook from the arguments. unset($args[0], $args[1]); - return Drupal::moduleHandler()->invoke($module, $hook, $args); + return \Drupal::moduleHandler()->invoke($module, $hook, $args); } /** @@ -2166,7 +2166,7 @@ function module_invoke($module, $hook) { * arguments by reference. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->invokeAll($hook). + * \Drupal::moduleHandler()->invokeAll($hook). * * @see drupal_alter() * @see \Drupal\Core\Extension\ModuleHandler::invokeAll() @@ -2175,43 +2175,43 @@ function module_invoke_all($hook) { $args = func_get_args(); // Remove $hook from the arguments. array_shift($args); - return Drupal::moduleHandler()->invokeAll($hook, $args); + return \Drupal::moduleHandler()->invokeAll($hook, $args); } /** * Passes alterable variables to specific hook_TYPE_alter() implementations. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->alter($hook). + * \Drupal::moduleHandler()->alter($hook). * * @see \Drupal\Core\Extension\ModuleHandler::alter() */ function drupal_alter($type, &$data, &$context1 = NULL, &$context2 = NULL) { - return Drupal::moduleHandler()->alter($type, $data, $context1, $context2); + return \Drupal::moduleHandler()->alter($type, $data, $context1, $context2); } /** * Determines whether a given module exists. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->moduleExists($module). + * \Drupal::moduleHandler()->moduleExists($module). * * @see \Drupal\Core\Extension\ModuleHandler::moduleExists() */ function module_exists($module) { - return Drupal::moduleHandler()->moduleExists($module); + return \Drupal::moduleHandler()->moduleExists($module); } /** * Determines whether a module implements a hook. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->implementsHook($module, $hook). + * \Drupal::moduleHandler()->implementsHook($module, $hook). * * @see \Drupal\Core\Extension\ModuleHandler::implementsHook() */ function module_hook($module, $hook) { - return Drupal::moduleHandler()->implementsHook($module, $hook); + return \Drupal::moduleHandler()->implementsHook($module, $hook); } /** @@ -2345,9 +2345,9 @@ function drupal_installation_attempted() { * Initializes all the defined language types and sets the default langcode. */ function drupal_language_initialize() { - $language_manager = Drupal::languageManager(); + $language_manager = \Drupal::languageManager(); $language_manager->init(); - Drupal::translation()->setDefaultLangcode($language_manager->getLanguage(Language::TYPE_INTERFACE)->id); + \Drupal::translation()->setDefaultLangcode($language_manager->getLanguage(Language::TYPE_INTERFACE)->id); } /** @@ -2359,10 +2359,10 @@ function drupal_language_initialize() { * The type of language object needed, e.g. Language::TYPE_INTERFACE. * * @deprecated as of Drupal 8.0. Use - * Drupal::languageManager()->getLanguage($type). + * \Drupal::languageManager()->getLanguage($type). */ function language($type) { - return Drupal::languageManager()->getLanguage($type); + return \Drupal::languageManager()->getLanguage($type); } /** @@ -2373,7 +2373,7 @@ function language($type) { * name and its value is its configurability (TRUE/FALSE). */ function language_types_get_all() { - $types = Drupal::config('system.language.types')->get('all'); + $types = \Drupal::config('system.language.types')->get('all'); return $types ? $types : array_keys(language_types_get_default()); } @@ -2399,7 +2399,7 @@ function language_types_get_default() { * TRUE if more than one language is enabled. */ function language_multilingual() { - return Drupal::languageManager()->isMultilingual(); + return \Drupal::languageManager()->isMultilingual(); } /** @@ -2433,7 +2433,7 @@ function language_list($flags = Language::STATE_CONFIGURABLE) { // save the same object without data loss. foreach ($language_entities as $langcode_config_name) { $langcode = substr($langcode_config_name, strlen('language.entity.')); - $info = Drupal::config($langcode_config_name)->get(); + $info = \Drupal::config($langcode_config_name)->get(); $languages[$langcode] = new Language(array( 'default' => ($info['id'] == $default->id), 'name' => $info['label'], @@ -3083,13 +3083,13 @@ function drupal_check_memory_limit($required, $memory_limit = NULL) { /** * Get locking layer instance. * - * @deprecated Use Drupal::lock() instead, or even better have the lock service + * @deprecated Use \Drupal::lock() instead, or even better have the lock service * injected into your object. * * @return Drupal\Core\Lock\LockBackendInterface */ function lock() { - return Drupal::lock(); + return \Drupal::lock(); } /** diff --git a/core/includes/cache.inc b/core/includes/cache.inc index edc47c7..d7dca8e 100644 --- a/core/includes/cache.inc +++ b/core/includes/cache.inc @@ -26,7 +26,7 @@ * @see Drupal\Core\Cache\CacheBackendInterface */ function cache($bin = 'cache') { - return Drupal::cache($bin); + return \Drupal::cache($bin); } /** diff --git a/core/includes/common.inc b/core/includes/common.inc index 94eac7d..be97724 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -361,7 +361,7 @@ function _drupal_default_html_head() { ); // Show Drupal and the major version number in the META GENERATOR tag. // Get the major version. - list($version, ) = explode('.', Drupal::VERSION); + list($version, ) = explode('.', \Drupal::VERSION); $elements['system_meta_generator'] = array( '#type' => 'html_tag', '#tag' => 'meta', @@ -447,7 +447,7 @@ function drupal_get_feeds($delimiter = "\n") { */ function drupal_get_query_parameters(array $query = NULL, array $exclude = array(), $parent = '') { if (!isset($query)) { - $query = Drupal::request()->query->all(); + $query = \Drupal::request()->query->all(); } return Url::filterQueryParameters($query, $exclude, $parent); } @@ -487,7 +487,7 @@ function drupal_get_destination() { return $destination; } - $query = Drupal::request()->query; + $query = \Drupal::request()->query; if ($query->has('destination')) { $destination = array('destination' => $query->get('destination')); } @@ -1110,7 +1110,7 @@ function format_interval($interval, $granularity = 2, $langcode = NULL) { * @see \Drupal\Component\Datetime\Date::format() */ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) { - return Drupal::service('date')->format($timestamp, $type, $format, $timezone, $langcode); + return \Drupal::service('date')->format($timestamp, $type, $format, $timezone, $langcode); } /** @@ -1201,7 +1201,7 @@ function datetime_default_format_type() { * @see \Drupal\Core\Routing\UrlGeneratorInterface::generateFromPath(). */ function url($path = NULL, array $options = array()) { - $generator = Drupal::urlGenerator(); + $generator = \Drupal::urlGenerator(); try { $url = $generator->generateFromPath($path, $options); } @@ -1345,7 +1345,7 @@ function l($text, $path, array $options = array()) { 'path' => current_path(), 'front_page' => drupal_is_front_page(), 'language' => language(Language::TYPE_URL)->id, - 'query' => Drupal::service('request')->query->all(), + 'query' => \Drupal::service('request')->query->all(), ); } @@ -1371,7 +1371,7 @@ function l($text, $path, array $options = array()) { } // Allow other modules to modify the structure of the link. - Drupal::moduleHandler()->alter('link', $variables); + \Drupal::moduleHandler()->alter('link', $variables); // Move attributes out of options. url() doesn't need them. $attributes = new Attribute($variables['options']['attributes']); @@ -1861,7 +1861,7 @@ function drupal_pre_render_styles($elements) { $css_assets = $elements['#items']; // Aggregate the CSS if necessary, but only during normal site operation. - if (!defined('MAINTENANCE_MODE') && Drupal::config('system.performance')->get('css.preprocess')) { + if (!defined('MAINTENANCE_MODE') && \Drupal::config('system.performance')->get('css.preprocess')) { $css_assets = \Drupal::service('asset.css.collection_optimizer')->optimize($css_assets); } return \Drupal::service('asset.css.collection_renderer')->render($css_assets); @@ -1871,7 +1871,7 @@ function drupal_pre_render_styles($elements) { * Deletes old cached CSS files. */ function drupal_clear_css_cache() { - Drupal::state()->delete('drupal_css_cache_files'); + \Drupal::state()->delete('drupal_css_cache_files'); file_scan_directory('public://css', '/.*/', array('callback' => 'drupal_delete_file_if_stale')); } @@ -1884,7 +1884,7 @@ function drupal_clear_css_cache() { */ function drupal_delete_file_if_stale($uri) { // Default stale file threshold is 30 days. - if (REQUEST_TIME - filemtime($uri) > Drupal::config('system.performance')->get('stale_file_threshold')) { + if (REQUEST_TIME - filemtime($uri) > \Drupal::config('system.performance')->get('stale_file_threshold')) { file_unmanaged_delete($uri); } } @@ -2488,7 +2488,7 @@ function drupal_pre_render_scripts($elements) { // Aggregate the JavaScript if necessary, but only during normal site // operation. - if (!defined('MAINTENANCE_MODE') && Drupal::config('system.performance')->get('js.preprocess')) { + if (!defined('MAINTENANCE_MODE') && \Drupal::config('system.performance')->get('js.preprocess')) { $js_assets = \Drupal::service('asset.js.collection_optimizer')->optimize($js_assets); } return \Drupal::service('asset.js.collection_renderer')->render($js_assets); @@ -2999,8 +2999,8 @@ function drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgro * Deletes old cached JavaScript files and variables. */ function drupal_clear_js_cache() { - Drupal::state()->delete('system.javascript_parsed'); - Drupal::state()->delete('system.js_cache_files'); + \Drupal::state()->delete('system.javascript_parsed'); + \Drupal::state()->delete('system.js_cache_files'); file_scan_directory('public://js', '/.*/', array('callback' => 'drupal_delete_file_if_stale')); } @@ -3106,7 +3106,7 @@ function _drupal_bootstrap_code() { require_once __DIR__ . '/entity.inc'; // Load all enabled modules - Drupal::moduleHandler()->loadAll(); + \Drupal::moduleHandler()->loadAll(); // Make sure all stream wrappers are registered. file_get_stream_wrappers(); @@ -3120,7 +3120,7 @@ function _drupal_bootstrap_code() { } // Set the allowed protocols once we have the config available. - $allowed_protocols = Drupal::config('system.filter')->get('protocols'); + $allowed_protocols = \Drupal::config('system.filter')->get('protocols'); if (!isset($allowed_protocols)) { // filter_xss_admin() is called by the installer and update.php, in which // case the configuration may not exist (yet). Provide a minimal default set @@ -3180,7 +3180,7 @@ function drupal_page_set_cache(Response $response, Request $request) { if (drupal_page_is_cacheable()) { // Check if the current page may be compressed. - $page_compressed = Drupal::config('system.performance')->get('response.gzip') && extension_loaded('zlib'); + $page_compressed = \Drupal::config('system.performance')->get('response.gzip') && extension_loaded('zlib'); $cache = (object) array( 'cid' => drupal_page_cache_get_cid($request), @@ -3248,7 +3248,7 @@ function drupal_cron_run() { $return = FALSE; // Grab the defined cron queues. - $queues = Drupal::moduleHandler()->invokeAll('queue_info'); + $queues = \Drupal::moduleHandler()->invokeAll('queue_info'); drupal_alter('queue_info', $queues); // Try to acquire cron lock. @@ -3261,12 +3261,12 @@ function drupal_cron_run() { // existing queue. foreach ($queues as $queue_name => $info) { if (isset($info['cron'])) { - Drupal::queue($queue_name)->createQueue(); + \Drupal::queue($queue_name)->createQueue(); } } // Iterate through the modules calling their cron handlers (if any): - foreach (Drupal::moduleHandler()->getImplementations('cron') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('cron') as $module) { // Do not let an exception thrown by one module disturb another. try { module_invoke($module, 'cron'); @@ -3277,7 +3277,7 @@ function drupal_cron_run() { } // Record cron time. - Drupal::state()->set('system.cron_last', REQUEST_TIME); + \Drupal::state()->set('system.cron_last', REQUEST_TIME); watchdog('cron', 'Cron run completed.', array(), WATCHDOG_NOTICE); // Release cron lock. @@ -3291,7 +3291,7 @@ function drupal_cron_run() { if (isset($info['cron'])) { $callback = $info['worker callback']; $end = time() + (isset($info['cron']['time']) ? $info['cron']['time'] : 15); - $queue = Drupal::queue($queue_name); + $queue = \Drupal::queue($queue_name); while (time() < $end && ($item = $queue->claimItem())) { call_user_func_array($callback, array($item->data)); $queue->deleteItem($item); @@ -3521,7 +3521,7 @@ function drupal_pre_render_link($element) { if (isset($element['#route_name'])) { $element['#route_parameters'] = empty($element['#route_parameters']) ? array() : $element['#route_parameters']; - $element['#markup'] = Drupal::linkGenerator()->generate($element['#title'], $element['#route_name'], $element['#route_parameters'], $element['#options']); + $element['#markup'] = \Drupal::linkGenerator()->generate($element['#title'], $element['#route_name'], $element['#route_parameters'], $element['#options']); } else { $element['#markup'] = l($element['#title'], $element['#href'], $element['#options']); @@ -3671,7 +3671,7 @@ function drupal_render_page($page) { } // Modules can add elements to $page as needed in hook_page_build(). - foreach (Drupal::moduleHandler()->getImplementations('page_build') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('page_build') as $module) { $function = $module . '_page_build'; $function($page); } @@ -4089,7 +4089,7 @@ function show(&$element) { * @see drupal_render_cache_set() */ function drupal_render_cache_get($elements) { - if (!Drupal::request()->isMethodSafe() || !$cid = drupal_render_cid_create($elements)) { + if (!\Drupal::request()->isMethodSafe() || !$cid = drupal_render_cid_create($elements)) { return FALSE; } $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache'; @@ -4121,7 +4121,7 @@ function drupal_render_cache_get($elements) { */ function drupal_render_cache_set(&$markup, $elements) { // Create the cache ID for the element. - if (!Drupal::request()->isMethodSafe() || !$cid = drupal_render_cid_create($elements)) { + if (!\Drupal::request()->isMethodSafe() || !$cid = drupal_render_cid_create($elements)) { return FALSE; } @@ -4361,7 +4361,7 @@ function element_info($type) { $cache = &$drupal_static_fast['cache']; if (!isset($cache)) { - $cache = Drupal::moduleHandler()->invokeAll('element_info'); + $cache = \Drupal::moduleHandler()->invokeAll('element_info'); foreach ($cache as $element_type => $info) { $cache[$element_type]['#type'] = $element_type; } @@ -4610,7 +4610,7 @@ function drupal_parse_info_file($filename) { $parser = new Parser(); $info[$filename] = $parser->parse(file_get_contents($filename)); if (isset($info[$filename]['version']) && $info[$filename]['version'] === 'VERSION') { - $info[$filename]['version'] = Drupal::VERSION; + $info[$filename]['version'] = \Drupal::VERSION; } } } @@ -4720,7 +4720,7 @@ function drupal_implode_tags($tags) { * requests. */ function drupal_flush_all_caches() { - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); // Flush all persistent caches. // This is executed based on old/previously known information, which is // sufficient, since new extensions cannot have any primed caches yet. @@ -4740,7 +4740,7 @@ function drupal_flush_all_caches() { drupal_static_reset(); // Clear all non-drupal_static() static caches. - Drupal::entityManager()->clearCachedDefinitions(); + \Drupal::entityManager()->clearCachedDefinitions(); // Wipe the PHP Storage caches. PhpStorageFactory::get('service_container')->deleteAll(); @@ -4759,9 +4759,9 @@ function drupal_flush_all_caches() { $files[$module] = $data->uri; } } - Drupal::service('kernel')->updateModules($module_handler->getModuleList(), $files); + \Drupal::service('kernel')->updateModules($module_handler->getModuleList(), $files); // New container, new module handler. - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); // Ensure that all modules that are currently supposed to be enabled are // actually loaded. @@ -4781,7 +4781,7 @@ function drupal_flush_all_caches() { // Rebuild the menu router based on all rebuilt data. // Important: This rebuild must happen last, so the menu router is guaranteed // to be based on up to date information. - Drupal::service('router.builder')->rebuild(); + \Drupal::service('router.builder')->rebuild(); menu_router_rebuild(); // Re-initialize the maintenance theme, if the current request attempted to @@ -4862,7 +4862,7 @@ function drupal_check_incompatibility($v, $current_version) { */ function archiver_get_extensions() { $valid_extensions = array(); - foreach (Drupal::service('plugin.manager.archiver')->getDefinitions() as $archive) { + foreach (\Drupal::service('plugin.manager.archiver')->getDefinitions() as $archive) { foreach ($archive['extensions'] as $extension) { foreach (explode('.', $extension) as $part) { if (!in_array($part, $valid_extensions)) { @@ -4892,7 +4892,7 @@ function archiver_get_archiver($file) { if (!is_file($filepath)) { throw new Exception(t('Archivers can only operate on local files: %file not supported', array('%file' => $file))); } - return Drupal::service('plugin.manager.archiver')->getInstance(array('filepath' => $filepath)); + return \Drupal::service('plugin.manager.archiver')->getInstance(array('filepath' => $filepath)); } /** @@ -4912,7 +4912,7 @@ function archiver_get_archiver($file) { function drupal_get_updaters() { $updaters = &drupal_static(__FUNCTION__); if (!isset($updaters)) { - $updaters = Drupal::moduleHandler()->invokeAll('updater_info'); + $updaters = \Drupal::moduleHandler()->invokeAll('updater_info'); drupal_alter('updater_info', $updaters); uasort($updaters, 'drupal_sort_weight'); } @@ -4932,7 +4932,7 @@ function drupal_get_updaters() { function drupal_get_filetransfer_info() { $info = &drupal_static(__FUNCTION__); if (!isset($info)) { - $info = Drupal::moduleHandler()->invokeAll('filetransfer_info'); + $info = \Drupal::moduleHandler()->invokeAll('filetransfer_info'); drupal_alter('filetransfer_info', $info); uasort($info, 'drupal_sort_weight'); } diff --git a/core/includes/config.inc b/core/includes/config.inc index a3f4a68..56364a8 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -66,17 +66,17 @@ function ($value) use ($name) { $config_to_install = array_merge($config_to_install, $other_module_config); } if (!empty($config_to_install)) { - $storage_comparer = new ExtensionInstallStorageComparer($source_storage, Drupal::service('config.storage')); + $storage_comparer = new ExtensionInstallStorageComparer($source_storage, \Drupal::service('config.storage')); $storage_comparer->setSourceNames($config_to_install); // Only import new config. Changed config is from previous enables and // should not be overwritten. $storage_comparer->addChangelistCreate(); $installer = new ConfigInstaller( $storage_comparer, - Drupal::service('event_dispatcher'), - Drupal::service('config.factory'), - Drupal::entityManager(), - Drupal::lock() + \Drupal::service('event_dispatcher'), + \Drupal::service('config.factory'), + \Drupal::entityManager(), + \Drupal::lock() ); $installer->import(); } @@ -94,7 +94,7 @@ function config_uninstall_default_config($type, $name) { $storage = drupal_container()->get('config.storage'); $config_names = $storage->listAll($name . '.'); foreach ($config_names as $config_name) { - Drupal::config($config_name)->delete(); + \Drupal::config($config_name)->delete(); } } @@ -126,7 +126,7 @@ function config_get_storage_names_with_prefix($prefix = '') { * A configuration object. */ function config($name) { - return Drupal::config($name); + return \Drupal::config($name); } /** @@ -134,7 +134,7 @@ function config($name) { * * This allows configuration objects to be created using special configuration * contexts eg. global override free or locale using a user preferred language. - * Calling this function affects all subsequent calls to Drupal::config() until + * Calling this function affects all subsequent calls to \Drupal::config() until * config_context_leave() is called. * * @see config_context_leave() diff --git a/core/includes/entity.api.php b/core/includes/entity.api.php index 8e60f00..e6e1f7c 100644 --- a/core/includes/entity.api.php +++ b/core/includes/entity.api.php @@ -91,7 +91,7 @@ function hook_entity_bundle_info_alter(&$bundles) { function hook_entity_bundle_create($entity_type, $bundle) { // When a new bundle is created, the menu needs to be rebuilt to add the // Field UI menu item tabs. - Drupal::state()->set('menu_rebuild_needed', TRUE); + \Drupal::state()->set('menu_rebuild_needed', TRUE); } /** @@ -108,7 +108,7 @@ function hook_entity_bundle_create($entity_type, $bundle) { */ function hook_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { // Update the settings associated with the bundle in my_module.settings. - $config = Drupal::config('my_module.settings'); + $config = \Drupal::config('my_module.settings'); $bundle_settings = $config->get('bundle_settings'); if (isset($bundle_settings[$entity_type][$bundle_old])) { $bundle_settings[$entity_type][$bundle_new] = $bundle_settings[$entity_type][$bundle_old]; @@ -129,7 +129,7 @@ function hook_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { */ function hook_entity_bundle_delete($entity_type, $bundle) { // Remove the settings associated with the bundle in my_module.settings. - $config = Drupal::config('my_module.settings'); + $config = \Drupal::config('my_module.settings'); $bundle_settings = $config->get('bundle_settings'); if (isset($bundle_settings[$entity_type][$bundle])) { unset($bundle_settings[$entity_type][$bundle]); diff --git a/core/includes/entity.inc b/core/includes/entity.inc index c5b64d5..b6b92b0 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -29,10 +29,10 @@ */ function entity_get_info($entity_type = NULL) { if (empty($entity_type)) { - return Drupal::entityManager()->getDefinitions(); + return \Drupal::entityManager()->getDefinitions(); } else { - return Drupal::entityManager()->getDefinition($entity_type); + return \Drupal::entityManager()->getDefinition($entity_type); } } @@ -42,8 +42,8 @@ function entity_get_info($entity_type = NULL) { function entity_info_cache_clear() { drupal_static_reset('entity_get_view_modes'); // Clear all languages. - Drupal::entityManager()->clearCachedDefinitions(); - Drupal::entityManager()->clearCachedFieldDefinitions(); + \Drupal::entityManager()->clearCachedDefinitions(); + \Drupal::entityManager()->clearCachedFieldDefinitions(); } /** @@ -61,10 +61,10 @@ function entity_info_cache_clear() { */ function entity_get_bundles($entity_type = NULL) { if (isset($entity_type)) { - return Drupal::entityManager()->getBundleInfo($entity_type); + return \Drupal::entityManager()->getBundleInfo($entity_type); } else { - return Drupal::entityManager()->getAllBundleInfo(); + return \Drupal::entityManager()->getAllBundleInfo(); } } @@ -86,10 +86,10 @@ function entity_invoke_bundle_hook($hook, $entity_type, $bundle, $bundle_new = N // Notify the entity storage controller. $method = 'onBundle' . ucfirst($hook); - Drupal::entityManager()->getStorageController($entity_type)->$method($bundle, $bundle_new); + \Drupal::entityManager()->getStorageController($entity_type)->$method($bundle, $bundle_new); // Invoke hook_entity_bundle_*() hooks. - Drupal::moduleHandler()->invokeAll('entity_bundle_' . $hook, array($entity_type, $bundle, $bundle_new)); + \Drupal::moduleHandler()->invokeAll('entity_bundle_' . $hook, array($entity_type, $bundle, $bundle_new)); } /** @@ -187,7 +187,7 @@ function entity_get_view_modes($entity_type = NULL) { * @see \Drupal\Core\Entity\Query\QueryInterface */ function entity_load($entity_type, $id, $reset = FALSE) { - $controller = Drupal::entityManager()->getStorageController($entity_type); + $controller = \Drupal::entityManager()->getStorageController($entity_type); if ($reset) { $controller->resetCache(array($id)); } @@ -211,7 +211,7 @@ function entity_load($entity_type, $id, $reset = FALSE) { * @see \Drupal\Core\Entity\DatabaseStorageController */ function entity_revision_load($entity_type, $revision_id) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getStorageController($entity_type) ->loadRevision($revision_id); } @@ -225,7 +225,7 @@ function entity_revision_load($entity_type, $revision_id) { * The revision ID to delete. */ function entity_revision_delete($entity_type, $revision_id) { - Drupal::entityManager() + \Drupal::entityManager() ->getStorageController($entity_type) ->deleteRevision($revision_id); } @@ -257,7 +257,7 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) { } $uuid_key = $entity_info['entity_keys']['uuid']; - $controller = Drupal::entityManager()->getStorageController($entity_type); + $controller = \Drupal::entityManager()->getStorageController($entity_type); if ($reset) { $controller->resetCache(); } @@ -299,7 +299,7 @@ function entity_load_by_uuid($entity_type, $uuid, $reset = FALSE) { * @see \Drupal\Core\Entity\Query\QueryInterface */ function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) { - $controller = Drupal::entityManager()->getStorageController($entity_type); + $controller = \Drupal::entityManager()->getStorageController($entity_type); if ($reset) { $controller->resetCache($ids); } @@ -319,7 +319,7 @@ function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) { * An array of entity objects indexed by their ids. */ function entity_load_multiple_by_properties($entity_type, array $values) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getStorageController($entity_type) ->loadByProperties($values); } @@ -341,7 +341,7 @@ function entity_load_multiple_by_properties($entity_type, array $values) { * The unchanged entity, or FALSE if the entity cannot be loaded. */ function entity_load_unchanged($entity_type, $id) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getStorageController($entity_type) ->loadUnchanged($id); } @@ -355,7 +355,7 @@ function entity_load_unchanged($entity_type, $id) { * An array of entity IDs of the entities to delete. */ function entity_delete_multiple($entity_type, array $ids) { - $controller = Drupal::entityManager()->getStorageController($entity_type); + $controller = \Drupal::entityManager()->getStorageController($entity_type); $entities = $controller->loadMultiple($ids); $controller->delete($entities); } @@ -373,7 +373,7 @@ function entity_delete_multiple($entity_type, array $ids) { * A new entity object. */ function entity_create($entity_type, array $values) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getStorageController($entity_type) ->create($values); } @@ -386,7 +386,7 @@ function entity_create($entity_type, array $values) { * @deprecated Use \Drupal\Core\Entity\EntityManager::getStorageController(). */ function entity_get_controller($entity_type) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getStorageController($entity_type); } @@ -424,7 +424,7 @@ function entity_page_label(EntityInterface $entity, $langcode = NULL) { * @deprecated Use \Drupal\Core\Entity\EntityManager::getRenderController(). */ function entity_access_controller($entity_type) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getAccessController($entity_type); } @@ -452,7 +452,7 @@ function entity_access_controller($entity_type) { * @deprecated Use \Drupal\Core\Entity\EntityManager::getFormController(). */ function entity_form_controller($entity_type, $operation = 'default') { - return Drupal::entityManager() + return \Drupal::entityManager() ->getFormController($entity_type, $operation); } @@ -469,7 +469,7 @@ function entity_form_controller($entity_type, $operation = 'default') { */ function entity_form_state_defaults(EntityInterface $entity, $operation = 'default') { $form_state = array(); - $controller = Drupal::entityManager()->getFormController($entity->entityType(), $operation); + $controller = \Drupal::entityManager()->getFormController($entity->entityType(), $operation); $controller->setEntity($entity); $form_state['build_info']['callback_object'] = $controller; $form_state['build_info']['base_form_id'] = $controller->getBaseFormID(); @@ -514,11 +514,11 @@ function entity_form_submit(EntityInterface $entity, $operation = 'default', &$f * @return * The processed form for the given entity and operation. * - * @deprecated Use Drupal::entityManager()->getForm() or _entity_form from a + * @deprecated Use \Drupal::entityManager()->getForm() or _entity_form from a * routing.yml file instead of a page callback. */ function entity_get_form(EntityInterface $entity, $operation = 'default', array $form_state = array()) { - return Drupal::entityManager()->getForm($entity, $operation, $form_state); + return \Drupal::entityManager()->getForm($entity, $operation, $form_state); } /** @@ -579,7 +579,7 @@ function entity_form_submit_build_entity($entity_type, $entity, $form, &$form_st * @deprecated Use \Drupal\Core\Entity\EntityManager::getFormController(). */ function entity_list_controller($entity_type) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getListController($entity_type); } @@ -595,7 +595,7 @@ function entity_list_controller($entity_type) { * @deprecated Use \Drupal\Core\Entity\EntityManager::getFormController(). */ function entity_render_controller($entity_type) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getRenderController($entity_type); } @@ -614,7 +614,7 @@ function entity_render_controller($entity_type) { * A render array for the entity. */ function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getRenderController($entity->entityType()) ->view($entity, $view_mode, $langcode); } @@ -635,7 +635,7 @@ function entity_view(EntityInterface $entity, $view_mode, $langcode = NULL) { * entities array passed in $entities. */ function entity_view_multiple(array $entities, $view_mode, $langcode = NULL) { - return Drupal::entityManager() + return \Drupal::entityManager() ->getRenderController(reset($entities)->entityType()) ->viewMultiple($entities, $view_mode, $langcode); } @@ -858,5 +858,5 @@ function entity_page_access(EntityInterface $entity, $operation = 'view') { * TRUE if the access is granted. FALSE if access is denied. */ function entity_page_create_access($entity_type, $bundle = NULL) { - return Drupal::entityManager()->getAccessController($entity_type)->createAccess($bundle); + return \Drupal::entityManager()->getAccessController($entity_type)->createAccess($bundle); } diff --git a/core/includes/errors.inc b/core/includes/errors.inc index 86ef93f..1639ba5 100644 --- a/core/includes/errors.inc +++ b/core/includes/errors.inc @@ -222,7 +222,7 @@ function _drupal_log_error($error, $fatal = FALSE) { } } - if (Drupal::request()->isXmlHttpRequest()) { + if (\Drupal::request()->isXmlHttpRequest()) { if ($fatal) { if (error_displayable($error)) { // When called from JavaScript, simply output the error message. @@ -295,7 +295,7 @@ function _drupal_log_error($error, $fatal = FALSE) { * DRUPAL_BOOTSTRAP_KERNEL or before Drupal is installed. In all other * situations the following code is preferred: * @code - * Drupal::config('system.logging')->get('error_level'); + * \Drupal::config('system.logging')->get('error_level'); * @endcode * * @return string @@ -303,7 +303,7 @@ function _drupal_log_error($error, $fatal = FALSE) { */ function _drupal_get_error_level() { try { - return Drupal::config('system.logging')->get('error_level'); + return \Drupal::config('system.logging')->get('error_level'); } catch (Exception $e) { // During very early install the cache_config table does not exist. diff --git a/core/includes/file.inc b/core/includes/file.inc index f713d1f..bb537fb 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -190,7 +190,7 @@ function file_get_stream_wrappers($filter = STREAM_WRAPPERS_ALL) { $wrappers_storage = &drupal_static(__FUNCTION__); if (!isset($wrappers_storage)) { - $wrappers = Drupal::moduleHandler()->invokeAll('stream_wrappers'); + $wrappers = \Drupal::moduleHandler()->invokeAll('stream_wrappers'); foreach ($wrappers as $scheme => $info) { // Add defaults. $wrappers[$scheme] += array('type' => STREAM_WRAPPERS_NORMAL); @@ -313,7 +313,7 @@ function file_uri_target($uri) { * 'public', 'private' or any other file scheme defined as the default. */ function file_default_scheme() { - return Drupal::config('system.file')->get('default_scheme'); + return \Drupal::config('system.file')->get('default_scheme'); } /** @@ -515,7 +515,7 @@ function file_prepare_directory(&$directory, $options = FILE_MODIFY_PERMISSIONS) */ function file_ensure_htaccess() { file_save_htaccess('public://', FALSE); - $private_path = Drupal::config('system.file')->get('path.private'); + $private_path = \Drupal::config('system.file')->get('path.private'); if (!empty($private_path)) { file_save_htaccess('private://', TRUE); } @@ -802,7 +802,7 @@ function file_munge_filename($filename, $extensions, $alerts = TRUE) { $original = $filename; // Allow potentially insecure uploads for very savvy users and admin - if (!Drupal::config('system.file')->get('allow_insecure_uploads')) { + if (!\Drupal::config('system.file')->get('allow_insecure_uploads')) { // Remove any null bytes. See http://php.net/manual/en/security.filesystem.nullbytes.php $filename = str_replace(chr(0), '', $filename); @@ -1272,13 +1272,13 @@ function drupal_chmod($uri, $mode = NULL) { // that the octal permission numbers can be expressed as integers or strings // and will be converted correctly in both cases. if (is_dir($uri)) { - $mode = octdec(Drupal::config('system.file')->get('chmod.directory')); + $mode = octdec(\Drupal::config('system.file')->get('chmod.directory')); if (!$mode) { $mode = 0775; } } else { - $mode = octdec(Drupal::config('system.file')->get('chmod.file')); + $mode = octdec(\Drupal::config('system.file')->get('chmod.file')); if (!$mode) { $mode = 0664; } @@ -1455,8 +1455,8 @@ function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) { // Configuration system stores default mode as strings. $mode = FALSE; // During early update there's no container. - if (is_object(Drupal::getContainer())) { - $mode = octdec(Drupal::config('system.file')->get('chmod.directory')); + if (is_object(\Drupal::getContainer())) { + $mode = octdec(\Drupal::config('system.file')->get('chmod.directory')); } if (!$mode) { $mode = 0775; @@ -1608,7 +1608,7 @@ function drupal_tempnam($directory, $prefix) { * A string containing the path to the temporary directory. */ function file_directory_temp() { - $config = Drupal::config('system.file'); + $config = \Drupal::config('system.file'); $temporary_directory = $config->get('path.temporary'); if (empty($temporary_directory)) { $temporary_directory = file_directory_os_temp(); diff --git a/core/includes/form.inc b/core/includes/form.inc index 8aee8f0..76106ee 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -545,10 +545,10 @@ function drupal_rebuild_form($form_id, &$form_state, $old_form = NULL) { * Fetches a form from the cache. */ function form_get_cache($form_build_id, &$form_state) { - if ($form = Drupal::keyValueExpirable('form')->get($form_build_id)) { + if ($form = \Drupal::keyValueExpirable('form')->get($form_build_id)) { global $user; if ((isset($form['#cache_token']) && drupal_valid_token($form['#cache_token'])) || (!isset($form['#cache_token']) && $user->isAnonymous())) { - if ($stored_form_state = Drupal::keyValueExpirable('form_state')->get($form_build_id)) { + if ($stored_form_state = \Drupal::keyValueExpirable('form_state')->get($form_build_id)) { // Re-populate $form_state for subsequent rebuilds. $form_state = $stored_form_state + $form_state; @@ -582,12 +582,12 @@ function form_set_cache($form_build_id, $form, $form_state) { if ($GLOBALS['user']->isAuthenticated()) { $form['#cache_token'] = drupal_get_token(); } - Drupal::keyValueExpirable('form')->setWithExpire($form_build_id, $form, $expire); + \Drupal::keyValueExpirable('form')->setWithExpire($form_build_id, $form, $expire); } // Cache form state. if ($data = array_diff_key($form_state, array_flip(form_state_keys_no_cache()))) { - Drupal::keyValueExpirable('form_state')->setWithExpire($form_build_id, $data, $expire); + \Drupal::keyValueExpirable('form_state')->setWithExpire($form_build_id, $data, $expire); } } @@ -820,7 +820,7 @@ function drupal_retrieve_form($form_id, &$form_state) { // So, we call the hook if $forms isn't yet populated, OR if it doesn't // yet have an entry for the requested form_id. if (!isset($forms) || !isset($forms[$form_id])) { - $forms = Drupal::moduleHandler()->invokeAll('forms', array($form_id, $args)); + $forms = \Drupal::moduleHandler()->invokeAll('forms', array($form_id, $args)); } $form_definition = $forms[$form_id]; if (isset($form_definition['callback arguments'])) { @@ -1346,8 +1346,8 @@ function drupal_redirect_form($form_state) { } } } - $url = url(Drupal::request()->attributes->get('_system_path'), array( - 'query' => Drupal::request()->query->all(), + $url = url(\Drupal::request()->attributes->get('_system_path'), array( + 'query' => \Drupal::request()->query->all(), 'absolute' => TRUE, )); return new RedirectResponse($url); @@ -4106,8 +4106,8 @@ function form_process_autocomplete($element, &$form_state) { if (!empty($element['#autocomplete_route_name'])) { $parameters = isset($element['#autocomplete_route_parameters']) ? $element['#autocomplete_route_parameters'] : array(); - $path = Drupal::urlGenerator()->generate($element['#autocomplete_route_name'], $parameters); - $access = Drupal::service('access_manager')->checkNamedRoute($element['#autocomplete_route_name'], $parameters); + $path = \Drupal::urlGenerator()->generate($element['#autocomplete_route_name'], $parameters); + $access = \Drupal::service('access_manager')->checkNamedRoute($element['#autocomplete_route_name'], $parameters); } elseif (!empty($element['#autocomplete_path'])) { $path = url($element['#autocomplete_path'], array('absolute' => TRUE)); @@ -4600,7 +4600,7 @@ function form_process_weight($element) { $element['#is_weight'] = TRUE; // If the number of options is small enough, use a select field. - $max_elements = Drupal::config('system.site')->get('weight_select_max'); + $max_elements = \Drupal::config('system.site')->get('weight_select_max'); if ($element['#delta'] <= $max_elements) { $element['#type'] = 'select'; for ($n = (-1 * $element['#delta']); $n <= $element['#delta']; $n++) { @@ -4881,11 +4881,11 @@ function _form_set_attributes(&$element, $class = array()) { * A response object. */ function _drupal_form_send_response(Response $response) { - $request = Drupal::request(); - $kernel = Drupal::service('http_kernel'); + $request = \Drupal::request(); + $kernel = \Drupal::service('http_kernel'); $event = new FilterResponseEvent($kernel, $request, $kernel::MASTER_REQUEST, $response); - Drupal::service('event_dispatcher')->dispatch(KernelEvents::RESPONSE, $event); + \Drupal::service('event_dispatcher')->dispatch(KernelEvents::RESPONSE, $event); // Prepare and send the response. $event->getResponse() ->prepare($request) @@ -5173,14 +5173,14 @@ function batch_process($redirect = NULL, $url = 'batch', $redirect_callback = NU // Clear the way for the redirection to the batch processing page, by // saving and unsetting the 'destination', if there is any. - $request = Drupal::request(); + $request = \Drupal::request(); if ($request->query->has('destination')) { $batch['destination'] = $request->query->get('destination'); $request->query->remove('destination'); } // Store the batch. - Drupal::service('batch.storage')->create($batch); + \Drupal::service('batch.storage')->create($batch); // Set the batch number in the session to guarantee that it will stay alive. $_SESSION['batches'][$batch['id']] = TRUE; diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 1aea928..b461342 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -329,7 +329,7 @@ function install_begin_request(&$install_state) { $container = new ContainerBuilder(); // Register the translation services. install_register_translation_service($container); - Drupal::setContainer($container); + \Drupal::setContainer($container); // Check existing settings.php. $install_state['database_verified'] = install_verify_database_settings(); @@ -444,18 +444,18 @@ function install_begin_request(&$install_state) { // so it is available to the rest of the installation process. $container->set('request', $request); - Drupal::setContainer($container); + \Drupal::setContainer($container); // Set up $language, so t() caller functions will still work. drupal_language_initialize(); // Add in installation language if present. if (isset($install_state['parameters']['langcode'])) { - Drupal::translation()->setDefaultLangcode($install_state['parameters']['langcode']); + \Drupal::translation()->setDefaultLangcode($install_state['parameters']['langcode']); } require_once __DIR__ . '/ajax.inc'; - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); if (!$module_handler->moduleExists('system')) { // Override the module list with a minimal set of modules. $module_handler->setModuleList(array('system' => 'core/modules/system/system.module')); @@ -652,7 +652,7 @@ function install_run_task($task, &$install_state) { // any output from the batch process, until the task is complete. elseif ($current_batch == $function) { include_once __DIR__ . '/batch.inc'; - $output = _batch_page(Drupal::request()); + $output = _batch_page(\Drupal::request()); // Because Batch API now returns a JSON response for intermediary steps, // but the installer doesn't handle Response objects yet, just send the // output here and emulate the old model. @@ -1005,7 +1005,7 @@ function install_base_system(&$install_state) { // after all the dependencies have been installed. $modules[] = drupal_get_profile(); - Drupal::state()->set('install_profile_modules', array_diff($modules, array('system'))); + \Drupal::state()->set('install_profile_modules', array_diff($modules, array('system'))); $install_state['database_tables_exist'] = TRUE; } @@ -1421,7 +1421,7 @@ function install_select_profile_form($form, &$form_state, $install_state) { */ function install_find_translations() { $translations = array(); - $files = Drupal::service('string_translator.file_translation')->findTranslationFiles(); + $files = \Drupal::service('string_translator.file_translation')->findTranslationFiles(); // English does not need a translation file. array_unshift($files, (object) array('name' => 'en')); foreach ($files as $uri => $file) { @@ -1653,7 +1653,7 @@ function install_retrieve_file($uri, $destination) { } try { - $request = Drupal::httpClient()->get($uri, array('Accept' => 'text/plain')); + $request = \Drupal::httpClient()->get($uri, array('Accept' => 'text/plain')); $data = $request->send()->getBody(TRUE); if (empty($data)) { return FALSE; @@ -1676,7 +1676,7 @@ function install_retrieve_file($uri, $destination) { */ function install_check_localization_server($uri) { try { - $request = Drupal::httpClient()->head($uri); + $request = \Drupal::httpClient()->head($uri); $request->send(); return TRUE; } @@ -1697,8 +1697,8 @@ function install_check_localization_server($uri) { * Associative array containing 'core' and 'version' of the release. */ function install_get_localization_release() { - if (strpos(Drupal::VERSION, 'dev')) { - list($version, ) = explode('-', Drupal::VERSION); + if (strpos(\Drupal::VERSION, 'dev')) { + list($version, ) = explode('-', \Drupal::VERSION); list($major, $minor) = explode('.', $version); // Calculate the major and minor release numbers to fall back to. @@ -1712,7 +1712,7 @@ function install_get_localization_release() { $release = "$major.$minor"; } else { - $release = Drupal::VERSION; + $release = \Drupal::VERSION; } return array( @@ -1781,9 +1781,9 @@ function install_bootstrap_full() { * The batch definition. */ function install_profile_modules(&$install_state) { - $modules = Drupal::state()->get('install_profile_modules') ?: array(); + $modules = \Drupal::state()->get('install_profile_modules') ?: array(); $files = system_rebuild_module_data(); - Drupal::state()->delete('install_profile_modules'); + \Drupal::state()->delete('install_profile_modules'); // Always install required modules first. Respect the dependencies between // the modules. @@ -1979,7 +1979,7 @@ function install_import_translations_remaining(&$install_state) { * @see install_tasks() */ function install_update_configuration_translations(&$install_state) { - Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); + \Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); return locale_config_batch_update_components(array(), array($install_state['parameters']['langcode'])); } @@ -2010,7 +2010,7 @@ function install_finished(&$install_state) { // Ensure the URL that is generated for the home page does not have 'install.php' // in it. $request = Request::createFromGlobals(); - $generator = Drupal::urlGenerator(); + $generator = \Drupal::urlGenerator(); $generator->setBasePath(str_replace('/core', '', $request->getBasePath()) . '/'); $generator->setScriptPath(''); $url = $generator->generateFromPath(''); @@ -2443,12 +2443,12 @@ function _install_configure_form($form, &$form_state, &$install_state) { '#title' => t('Regional settings'), ); - $countries = Drupal::service('country_manager')->getList(); + $countries = \Drupal::service('country_manager')->getList(); $form['regional_settings']['site_default_country'] = array( '#type' => 'select', '#title' => t('Default country'), '#empty_value' => '', - '#default_value' => Drupal::config('system.date')->get('country.default'), + '#default_value' => \Drupal::config('system.date')->get('country.default'), '#options' => $countries, '#description' => t('Select the default country for the site.'), '#weight' => 0, @@ -2516,13 +2516,13 @@ function install_configure_form_validate($form, &$form_state) { function install_configure_form_submit($form, &$form_state) { global $user; - Drupal::config('system.site') + \Drupal::config('system.site') ->set('name', $form_state['values']['site_name']) ->set('mail', $form_state['values']['site_mail']) ->set('langcode', language_default()->id) ->save(); - Drupal::config('system.date') + \Drupal::config('system.date') ->set('timezone.default', $form_state['values']['date_default_timezone']) ->set('country.default', $form_state['values']['site_default_country']) ->save(); @@ -2534,7 +2534,7 @@ function install_configure_form_submit($form, &$form_state) { // Add the site maintenance account's email address to the list of // addresses to be notified when updates are available, if selected. if ($form_state['values']['update_status_module'][2]) { - Drupal::config('update.settings')->set('notification.emails', array($form_state['values']['account']['mail']))->save(); + \Drupal::config('update.settings')->set('notification.emails', array($form_state['values']['account']['mail']))->save(); } } diff --git a/core/includes/install.inc b/core/includes/install.inc index c308a2d..fdf8e84 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -627,18 +627,18 @@ function drupal_install_system() { require_once DRUPAL_ROOT . '/' . $system_path . '/system.install'; $system_versions = drupal_get_schema_versions('system'); $system_version = $system_versions ? max($system_versions) : SCHEMA_INSTALLED; - Drupal::keyValue('system.schema')->set('system', $system_version); + \Drupal::keyValue('system.schema')->set('system', $system_version); // System module needs to be enabled and the system/module lists need to be // reset first in order to allow config_install_default_config() to invoke // config import callbacks. // @todo Installation profiles may override the system.module config object. - Drupal::config('system.module') + \Drupal::config('system.module') ->set('enabled.system', 0) ->save(); // Update the module list to include it. - Drupal::moduleHandler()->setModuleList(array('system' => $system_path . '/system.module')); + \Drupal::moduleHandler()->setModuleList(array('system' => $system_path . '/system.module')); config_install_default_config('module', 'system'); diff --git a/core/includes/language.inc b/core/includes/language.inc index 44e91c1..6b5a757 100644 --- a/core/includes/language.inc +++ b/core/includes/language.inc @@ -161,7 +161,7 @@ function language_types_info() { $language_types = &drupal_static(__FUNCTION__); if (!isset($language_types)) { - $language_types = Drupal::moduleHandler()->invokeAll('language_types_info'); + $language_types = \Drupal::moduleHandler()->invokeAll('language_types_info'); // Let other modules alter the list of language types. drupal_alter('language_types_info', $language_types); } @@ -180,7 +180,7 @@ function language_types_info() { * An array of language type names. */ function language_types_get_configurable() { - $configurable = Drupal::config('system.language.types')->get('configurable'); + $configurable = \Drupal::config('system.language.types')->get('configurable'); return $configurable ? $configurable : array(); } @@ -192,7 +192,7 @@ function language_types_get_configurable() { */ function language_types_disable($types) { $configurable = language_types_get_configurable(); - Drupal::config('system.language.types')->set('configurable', array_diff($configurable, $types))->save(); + \Drupal::config('system.language.types')->set('configurable', array_diff($configurable, $types))->save(); } /** @@ -252,7 +252,7 @@ function language_types_set(array $configurable_language_types) { } // Store the language type configuration. - $config = Drupal::config('system.language.types'); + $config = \Drupal::config('system.language.types'); $config->set('configurable', array_keys(array_filter($language_types)))->save(); $config->set('all', array_keys($language_types))->save(); @@ -413,7 +413,7 @@ function language_negotiation_info() { if (!isset($negotiation_info)) { // Collect all the module-defined language negotiation methods. - $negotiation_info = Drupal::moduleHandler()->invokeAll('language_negotiation_info'); + $negotiation_info = \Drupal::moduleHandler()->invokeAll('language_negotiation_info'); $languages = language_list(); $selected_language = $languages[language_from_selected($languages)]; $description = 'Language based on a selected language. '; @@ -493,7 +493,7 @@ function language_negotiation_method_invoke($method_id, $method = NULL, $request * A valid language code on success, FALSE otherwise. */ function language_from_selected($languages) { - $langcode = (string) Drupal::config('language.negotiation')->get('selected_langcode'); + $langcode = (string) \Drupal::config('language.negotiation')->get('selected_langcode'); // Replace the site's default langcode by its real value. if ($langcode == 'site_default') { $langcode = language_default()->id; diff --git a/core/includes/mail.inc b/core/includes/mail.inc index 5c8117d..20f01da 100644 --- a/core/includes/mail.inc +++ b/core/includes/mail.inc @@ -119,7 +119,7 @@ * accepted at php-level, which still doesn't guarantee it to be delivered.) */ function drupal_mail($module, $key, $to, $langcode, $params = array(), $from = NULL, $send = TRUE) { - $site_config = Drupal::config('system.site'); + $site_config = \Drupal::config('system.site'); $site_mail = $site_config->get('mail'); if (empty($site_mail)) { $site_mail = ini_get('sendmail_from'); @@ -214,7 +214,7 @@ function drupal_mail($module, $key, $to, $langcode, $params = array(), $from = N * @see \Drupal\Core\Mail\MailFactory::get() */ function drupal_mail_system($module, $key) { - return Drupal::service('mail.factory')->get($module, $key); + return \Drupal::service('mail.factory')->get($module, $key); } /** diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 227dd3e..f289cbb 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -339,7 +339,7 @@ function menu_get_ancestors($parts) { $ancestors = array(); $length = $number_parts - 1; $end = (1 << $number_parts) - 1; - $masks = Drupal::state()->get('menu.masks'); + $masks = \Drupal::state()->get('menu.masks'); // If the optimized menu.masks array is not available use brute force to get // the correct $ancestors and $placeholders returned. Do not use this as the // default value of the menu.masks variable to avoid building such a big @@ -473,7 +473,7 @@ function menu_get_item($path = NULL, $router_item = NULL) { if (!isset($router_items[$path])) { // Rebuild if we know it's needed, or if the menu masks are missing which // occurs rarely, likely due to a race condition of multiple rebuilds. - if (Drupal::state()->get('menu_rebuild_needed') || !Drupal::state()->get('menu.masks')) { + if (\Drupal::state()->get('menu_rebuild_needed') || !\Drupal::state()->get('menu.masks')) { menu_router_rebuild(); } $original_map = arg(NULL, $path); @@ -783,7 +783,7 @@ function _menu_translate(&$router_item, $map, $to_arg = FALSE) { // with the link map. $map = $link_map; - $route_provider = Drupal::getContainer()->get('router.route_provider'); + $route_provider = \Drupal::getContainer()->get('router.route_provider'); $route = $route_provider->getRouteByName($router_item['route_name']); $router_item['access'] = menu_item_route_access($route, $router_item['href'], $map); } @@ -975,7 +975,7 @@ function menu_item_route_access(Route $route, $href, &$map) { // Attempt to match this path to provide a fully built request to the // access checker. try { - $request->attributes->add(Drupal::service('router.dynamic')->matchRequest($request)); + $request->attributes->add(\Drupal::service('router.dynamic')->matchRequest($request)); } catch (NotFoundHttpException $e) { return FALSE; @@ -996,7 +996,7 @@ function menu_item_route_access(Route $route, $href, &$map) { } } - return Drupal::service('access_manager')->check($route, $request); + return \Drupal::service('access_manager')->check($route, $request); } /** @@ -1358,13 +1358,13 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = } $parents = $active_trail; - $expanded = Drupal::state()->get('menu_expanded'); + $expanded = \Drupal::state()->get('menu_expanded'); // Check whether the current menu has any links set to be expanded. if (!$only_active_trail && $expanded && in_array($menu_name, $expanded)) { // Collect all the links set to be expanded, and then add all of // their children to the list as well. do { - $query = Drupal::entityQuery('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('menu_name', $menu_name) ->condition('expanded', 1) ->condition('has_children', 1) @@ -1459,7 +1459,7 @@ function _menu_build_tree($menu_name, array $parameters = array()) { } if (!isset($trees[$tree_cid])) { - $query = Drupal::entityQuery('menu_link'); + $query = \Drupal::entityQuery('menu_link'); for ($i = 1; $i <= MENU_MAX_DEPTH; $i++) { $query->sort('p' . $i, 'ASC'); } @@ -1769,7 +1769,7 @@ function menu_get_active_help() { $arg = drupal_help_arg(arg(NULL)); - foreach (Drupal::moduleHandler()->getImplementations('help') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('help') as $module) { $function = $module . '_help'; // Lookup help for this path. if ($help = $function($router_path, $arg)) { @@ -1799,7 +1799,7 @@ function menu_get_custom_theme($initialize = FALSE) { // First allow modules to dynamically set a custom theme for the current // page. Since we can only have one, the last module to return a valid // theme takes precedence. - $custom_themes = array_filter(Drupal::moduleHandler()->invokeAll('custom_theme'), 'drupal_theme_access'); + $custom_themes = array_filter(\Drupal::moduleHandler()->invokeAll('custom_theme'), 'drupal_theme_access'); if (!empty($custom_themes)) { $custom_theme = array_pop($custom_themes); } @@ -1841,7 +1841,7 @@ function menu_list_system_menus() { * Returns an array of links to be rendered as the Main menu. */ function menu_main_menu() { - $config = Drupal::config('menu.settings'); + $config = \Drupal::config('menu.settings'); $menu_enabled = module_exists('menu'); // When menu module is not enabled, we need a hardcoded default value. $main_links_source = $menu_enabled ? $config->get('main_links') : 'main'; @@ -1852,7 +1852,7 @@ function menu_main_menu() { * Returns an array of links to be rendered as the Secondary links. */ function menu_secondary_menu() { - $config = Drupal::config('menu.settings'); + $config = \Drupal::config('menu.settings'); $menu_enabled = module_exists('menu'); // When menu module is not enabled, we need a hardcoded default value. $main_links_source = $menu_enabled ? $config->get('main_links') : 'main'; @@ -2145,9 +2145,9 @@ function menu_local_tasks($level = 0) { $tabs = array_values($tabs); $data['tabs'] = $tabs; // Look for route-based tabs. - $route_name = Drupal::request()->attributes->get('_route'); + $route_name = \Drupal::request()->attributes->get('_route'); 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); @@ -2155,7 +2155,7 @@ function menu_local_tasks($level = 0) { } // Allow modules to dynamically add further tasks. - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); foreach ($module_handler->getImplementations('menu_local_tasks') as $module) { $function = $module . '_menu_local_tasks'; $function($data, $router_item, $root_path); @@ -2309,7 +2309,7 @@ function menu_secondary_local_tasks() { function menu_get_local_actions() { $links = menu_local_tasks(); $router_item = menu_get_item(); - $manager = Drupal::service('plugin.manager.menu.local_action'); + $manager = \Drupal::service('plugin.manager.menu.local_action'); $local_actions = $manager->getActionsForRoute($router_item['route_name']); foreach ($local_actions as $plugin) { $route_path = $manager->getPath($plugin); @@ -2396,7 +2396,7 @@ function menu_set_active_menu_names($menu_names = NULL) { $active = $menu_names; } elseif (!isset($active)) { - $config = Drupal::config('system.menu'); + $config = \Drupal::config('system.menu'); $active = $config->get('active_menus_default') ?: array_keys(menu_list_system_menus()); } return $active; @@ -2652,7 +2652,7 @@ function menu_get_active_breadcrumb() { // Don't show a link to the current page in the breadcrumb trail. $end = end($active_trail); - if (Drupal::request()->attributes->get('_system_path') == $end['href']) { + if (\Drupal::request()->attributes->get('_system_path') == $end['href']) { array_pop($active_trail); } @@ -2717,7 +2717,7 @@ function menu_cache_clear_all() { * Resets the menu system static cache. */ function menu_reset_static_cache() { - Drupal::entityManager() + \Drupal::entityManager() ->getStorageController('menu_link')->resetCache(); drupal_static_reset('_menu_build_tree'); drupal_static_reset('menu_tree'); @@ -2755,7 +2755,7 @@ function menu_router_rebuild() { menu_cache_clear_all(); _menu_clear_page_cache(); // Indicate that the menu has been successfully rebuilt. - Drupal::state()->delete('menu_rebuild_needed'); + \Drupal::state()->delete('menu_rebuild_needed'); } catch (Exception $e) { $transaction->rollback(); @@ -2776,7 +2776,7 @@ function menu_router_build($save = FALSE) { // We need to manually call each module so that we can know which module // a given item came from. $callbacks = array(); - foreach (Drupal::moduleHandler()->getImplementations('menu') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('menu') as $module) { $router_items = call_user_func($module . '_menu'); if (isset($router_items) && is_array($router_items)) { foreach (array_keys($router_items) as $path) { @@ -2823,7 +2823,7 @@ function menu_router_build($save = FALSE) { * The translated path pattern from the route. */ function _menu_router_translate_route($route_name) { - $outline = Drupal::service('router.route_provider') + $outline = \Drupal::service('router.route_provider') ->getRouteByName($route_name) ->compile() ->getPatternOutline(); @@ -2865,7 +2865,7 @@ function _menu_navigation_links_rebuild($menu) { // when possible. return; } - $menu_link_controller = Drupal::entityManager() + $menu_link_controller = \Drupal::entityManager() ->getStorageController('menu_link'); // Add normal and suggested items as links. @@ -2951,7 +2951,7 @@ function _menu_navigation_links_rebuild($menu) { } // Find any item whose router path does not exist any more. - $query = Drupal::entityQuery('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('router_path', $paths, 'NOT IN') ->condition('external', 0) ->condition('updated', 0) @@ -2978,7 +2978,7 @@ function _menu_navigation_links_rebuild($menu) { function menu_load_links($menu_name) { $links = array(); - $query = Drupal::entityQuery('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('menu_name', $menu_name) // Order by weight so as to be helpful for menus that are only one level // deep. @@ -3030,7 +3030,7 @@ function _menu_clear_page_cache() { */ function _menu_set_expanded_menus() { $names = db_query("SELECT menu_name FROM {menu_links} WHERE expanded <> 0 GROUP BY menu_name")->fetchCol(); - Drupal::state()->set('menu_expanded', $names); + \Drupal::state()->set('menu_expanded', $names); } /** @@ -3305,8 +3305,8 @@ function _menu_router_build($callbacks, $save = FALSE) { $path_roots = array_values($path_roots); // Update the path roots variable and reset the path alias whitelist cache // if the list has changed. - if ($path_roots != Drupal::state()->get('menu_path_roots')) { - Drupal::state()->set('menu_path_roots', array_values($path_roots)); + if ($path_roots != \Drupal::state()->get('menu_path_roots')) { + \Drupal::state()->set('menu_path_roots', array_values($path_roots)); drupal_container()->get('path.alias_manager')->cacheClear(); } _menu_router_save($menu, $masks); @@ -3394,7 +3394,7 @@ function _menu_router_save($menu, $masks) { // Insert any remaining records. $insert->execute(); // Store the masks. - Drupal::state()->set('menu.masks', $masks); + \Drupal::state()->set('menu.masks', $masks); return $menu; } @@ -3418,7 +3418,7 @@ function _menu_router_save($menu, $masks) { */ function _menu_site_is_offline($check_only = FALSE) { // Check if site is in maintenance mode. - if (Drupal::state()->get('system.maintenance_mode')) { + if (\Drupal::state()->get('system.maintenance_mode')) { if (user_access('access site in maintenance mode')) { // Ensure that the maintenance mode message is displayed only once // (allowing for page redirects) and specifically suppress its display on diff --git a/core/includes/module.inc b/core/includes/module.inc index 1a32c09..daaeb4b 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -24,7 +24,7 @@ * @see list_themes() * * @todo There are too many layers/levels of caching involved for system_list() - * data. Consider to add a Drupal::config($name, $cache = TRUE) argument to allow + * data. Consider to add a \Drupal::config($name, $cache = TRUE) argument to allow * callers like system_list() to force-disable a possible configuration * storage controller cache or some other way to circumvent it/take it over. */ @@ -39,12 +39,12 @@ function system_list($type) { 'filepaths' => array(), ); // Build a list of themes. - $enabled_themes = (array) Drupal::config('system.theme')->get('enabled'); + $enabled_themes = (array) \Drupal::config('system.theme')->get('enabled'); // @todo Themes include all themes, including disabled/uninstalled. This // system.theme.data state will go away entirely as soon as themes have // a proper installation status. // @see http://drupal.org/node/1067408 - $theme_data = Drupal::state()->get('system.theme.data'); + $theme_data = \Drupal::state()->get('system.theme.data'); if (empty($theme_data)) { // @todo: system_list() may be called from _drupal_bootstrap_code(), in // which case system.module is not loaded yet. @@ -119,7 +119,7 @@ function system_list_reset() { // will cause system_list_reset() to be called, but theme data is not // necessarily rebuilt afterwards. // @todo Obsolete with proper installation status for themes. - Drupal::state()->delete('system.theme.data'); + \Drupal::state()->delete('system.theme.data'); } /** @@ -206,30 +206,30 @@ function module_load_include($type, $module, $name = NULL) { * Enables or installs a given list of modules. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->enable($module_list, $enable_dependencies = TRUE). + * \Drupal::moduleHandler()->enable($module_list, $enable_dependencies = TRUE). */ function module_enable($module_list, $enable_dependencies = TRUE) { - return Drupal::moduleHandler()->enable($module_list, $enable_dependencies); + return \Drupal::moduleHandler()->enable($module_list, $enable_dependencies); } /** * Disables a given set of modules. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->disable($module_list, $disable_dependents = TRUE). + * \Drupal::moduleHandler()->disable($module_list, $disable_dependents = TRUE). */ function module_disable($module_list, $disable_dependents = TRUE) { - Drupal::moduleHandler()->disable($module_list, $disable_dependents); + \Drupal::moduleHandler()->disable($module_list, $disable_dependents); } /** * Uninstalls a given list of disabled modules. * * @deprecated as of Drupal 8.0. Use - * Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents = TRUE). + * \Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents = TRUE). */ function module_uninstall($module_list = array(), $uninstall_dependents = TRUE) { - return Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents); + return \Drupal::moduleHandler()->uninstall($module_list, $uninstall_dependents); } /** @@ -324,7 +324,7 @@ function drupal_required_modules() { */ function module_set_weight($module, $weight) { // Update the module weight in the config file that contains it. - $module_config = Drupal::config('system.module'); + $module_config = \Drupal::config('system.module'); if ($module_config->get("enabled.$module") !== NULL) { $module_config ->set("enabled.$module", $weight) @@ -333,7 +333,7 @@ function module_set_weight($module, $weight) { // Prepare the new module list, sorted by weight, including filenames. // @see module_enable() - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); $current_module_filenames = $module_handler->getModuleList(); $current_modules = array_fill_keys(array_keys($current_module_filenames), 0); $current_modules = module_config_sort(array_merge($current_modules, $module_config->get('enabled'))); @@ -345,7 +345,7 @@ function module_set_weight($module, $weight) { $module_handler->setModuleList($module_filenames); return; } - $disabled_config = Drupal::config('system.module.disabled'); + $disabled_config = \Drupal::config('system.module.disabled'); if ($disabled_config->get($module) !== NULL) { $disabled_config ->set($module, $weight) diff --git a/core/includes/pager.inc b/core/includes/pager.inc index 4654012..67fbf5d 100644 --- a/core/includes/pager.inc +++ b/core/includes/pager.inc @@ -27,7 +27,7 @@ * @see pager_default_initialize() */ function pager_find_page($element = 0) { - $page = Drupal::request()->query->get('page', ''); + $page = \Drupal::request()->query->get('page', ''); $page_array = explode(',', $page); if (!isset($page_array[$element])) { $page_array[$element] = 0; @@ -137,7 +137,7 @@ function pager_default_initialize($total, $limit, $element = 0) { function pager_get_query_parameters() { $query = &drupal_static(__FUNCTION__); if (!isset($query)) { - $query = Url::filterQueryParameters(Drupal::request()->query->all(), array('page')); + $query = Url::filterQueryParameters(\Drupal::request()->query->all(), array('page')); } return $query; } @@ -426,7 +426,7 @@ function pager_query_add_page(array $query, $element, $index) { // Determine the first result to display on the linked page. $page_new = pager_load_array($index, $element, $pager_page_array); - $page = Drupal::request()->query->get('page', ''); + $page = \Drupal::request()->query->get('page', ''); if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) { $query['page'] = $new_page; } diff --git a/core/includes/path.inc b/core/includes/path.inc index ba1da88..2187dd3 100644 --- a/core/includes/path.inc +++ b/core/includes/path.inc @@ -22,7 +22,7 @@ function drupal_is_front_page() { $is_front_page = &$drupal_static_fast['is_front_page']; if (!isset($is_front_page)) { - $is_front_page = (current_path() == Drupal::config('system.site')->get('page.front')); + $is_front_page = (current_path() == \Drupal::config('system.site')->get('page.front')); } return $is_front_page; @@ -53,7 +53,7 @@ function drupal_match_path($path, $patterns) { $replacements = array( '|', '.*', - '\1' . preg_quote(Drupal::config('system.site')->get('page.front'), '/') . '\2' + '\1' . preg_quote(\Drupal::config('system.site')->get('page.front'), '/') . '\2' ); $patterns_quoted = preg_quote($patterns, '/'); $regexps[$patterns] = '/^(' . preg_replace($to_replace, $replacements, $patterns_quoted) . ')$/'; @@ -158,7 +158,7 @@ function path_is_admin($path) { function path_get_admin_paths() { $patterns = &drupal_static(__FUNCTION__); if (!isset($patterns)) { - $paths = Drupal::moduleHandler()->invokeAll('admin_paths'); + $paths = \Drupal::moduleHandler()->invokeAll('admin_paths'); drupal_alter('admin_paths', $paths); // Combine all admin paths into one array, and likewise for non-admin paths, // for easier handling. @@ -214,7 +214,7 @@ function drupal_valid_path($path, $dynamic_allowed = FALSE) { // Check the new routing system. if (!empty($item['route_name'])) { $map = array(); - $route = Drupal::service('router.route_provider')->getRouteByName($item['route_name']); + $route = \Drupal::service('router.route_provider')->getRouteByName($item['route_name']); $item['access'] = menu_item_route_access($route, $path, $map); } $menu_admin = FALSE; diff --git a/core/includes/schema.inc b/core/includes/schema.inc index ac0ffad..6563621 100644 --- a/core/includes/schema.inc +++ b/core/includes/schema.inc @@ -77,11 +77,11 @@ function drupal_get_complete_schema($rebuild = FALSE) { else { $schema = array(); // Load the .install files to get hook_schema. - Drupal::moduleHandler()->loadAllIncludes('install'); + \Drupal::moduleHandler()->loadAllIncludes('install'); require_once __DIR__ . '/common.inc'; // Invoke hook_schema for all modules. - foreach (Drupal::moduleHandler()->getImplementations('schema') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('schema') as $module) { // Cast the result of hook_schema() to an array, as a NULL return value // would cause array_merge() to set the $schema variable to NULL as well. // That would break modules which use $schema further down the line. @@ -121,7 +121,7 @@ function drupal_get_schema_versions($module) { $updates = &drupal_static(__FUNCTION__, NULL); if (!isset($updates[$module])) { $updates = array(); - foreach (Drupal::moduleHandler()->getModuleList() as $loaded_module => $filename) { + foreach (\Drupal::moduleHandler()->getModuleList() as $loaded_module => $filename) { $updates[$loaded_module] = array(); } @@ -173,7 +173,7 @@ function drupal_get_installed_schema_version($module, $reset = FALSE, $array = F } if (!$versions) { - if (!$versions = Drupal::keyValue('system.schema')->getAll()) { + if (!$versions = \Drupal::keyValue('system.schema')->getAll()) { $versions = array(); } } @@ -195,7 +195,7 @@ function drupal_get_installed_schema_version($module, $reset = FALSE, $array = F * The new schema version. */ function drupal_set_installed_schema_version($module, $version) { - Drupal::keyValue('system.schema')->set($module, $version); + \Drupal::keyValue('system.schema')->set($module, $version); // Reset the static cache of module schema versions. drupal_get_installed_schema_version(NULL, TRUE); } diff --git a/core/includes/session.inc b/core/includes/session.inc index 0e01693..4cc8139 100644 --- a/core/includes/session.inc +++ b/core/includes/session.inc @@ -92,7 +92,7 @@ function _drupal_session_read($sid) { // client's session in the database. If it's HTTPS then we are either have // a HTTPS session or we are about to log in so we check the sessions table // for an anonymous session with the non-HTTPS-only cookie. - if (Drupal::request()->isSecure()) { + if (\Drupal::request()->isSecure()) { $values = db_query("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.ssid = :ssid", array(':ssid' => $sid))->fetchAssoc(); if (!$values) { if (isset($_COOKIE[$insecure_session_name])) { @@ -176,7 +176,7 @@ function _drupal_session_write($sid, $value) { // Either ssid or sid or both will be added from $key below. $fields = array( 'uid' => $user->id(), - 'hostname' => Drupal::request()->getClientIP(), + 'hostname' => \Drupal::request()->getClientIP(), 'session' => $value, 'timestamp' => REQUEST_TIME, ); @@ -186,7 +186,7 @@ function _drupal_session_write($sid, $value) { // default. $key = array('sid' => $sid, 'ssid' => ''); // On HTTPS connections, use the session ID as both 'sid' and 'ssid'. - if (Drupal::request()->isSecure()) { + if (\Drupal::request()->isSecure()) { $key['ssid'] = $sid; // The "secure pages" setting allows a site to simultaneously use both // secure and insecure session cookies. If enabled and both cookies are @@ -240,7 +240,7 @@ function drupal_session_initialize() { session_set_save_handler('_drupal_session_open', '_drupal_session_close', '_drupal_session_read', '_drupal_session_write', '_drupal_session_destroy', '_drupal_session_garbage_collection'); - $is_https = Drupal::request()->isSecure(); + $is_https = \Drupal::request()->isSecure(); // We use !empty() in the following check to ensure that blank session IDs // are not valid. if (!empty($_COOKIE[session_name()]) || ($is_https && settings()->get('mixed_mode_sessions', FALSE) && !empty($_COOKIE[substr(session_name(), 1)]))) { @@ -319,7 +319,7 @@ function drupal_session_commit() { // started. if (!drupal_session_started()) { drupal_session_start(); - if (Drupal::request()->isSecure() && settings()->get('mixed_mode_sessions', FALSE)) { + if (\Drupal::request()->isSecure() && settings()->get('mixed_mode_sessions', FALSE)) { $insecure_session_name = substr(session_name(), 1); $params = session_get_cookie_params(); $expire = $params['lifetime'] ? REQUEST_TIME + $params['lifetime'] : 0; @@ -355,7 +355,7 @@ function drupal_session_regenerate() { return; } - $is_https = Drupal::request()->isSecure(); + $is_https = \Drupal::request()->isSecure(); if ($is_https && settings()->get('mixed_mode_sessions', FALSE)) { $insecure_session_name = substr(session_name(), 1); @@ -431,7 +431,7 @@ function _drupal_session_destroy($sid) { return; } - $is_https = Drupal::request()->isSecure(); + $is_https = \Drupal::request()->isSecure(); // Delete session data. db_delete('sessions') ->condition($is_https ? 'ssid' : 'sid', $sid) @@ -461,7 +461,7 @@ function _drupal_session_destroy($sid) { * Force the secure value of the cookie. */ function _drupal_session_delete_cookie($name, $secure = NULL) { - if (isset($_COOKIE[$name]) || (!Drupal::request()->isSecure() && $secure === TRUE)) { + if (isset($_COOKIE[$name]) || (!\Drupal::request()->isSecure() && $secure === TRUE)) { $params = session_get_cookie_params(); if ($secure !== NULL) { $params['secure'] = $secure; diff --git a/core/includes/tablesort.inc b/core/includes/tablesort.inc index 14da51c..1f6962b 100644 --- a/core/includes/tablesort.inc +++ b/core/includes/tablesort.inc @@ -101,7 +101,7 @@ function tablesort_cell($cell, $header, $ts, $i) { * page request except for those pertaining to table sorting. */ function tablesort_get_query_parameters() { - return Url::filterQueryParameters(Drupal::request()->query->all(), array('sort', 'order')); + return Url::filterQueryParameters(\Drupal::request()->query->all(), array('sort', 'order')); } /** @@ -116,7 +116,7 @@ function tablesort_get_query_parameters() { * - "sql": The name of the database field to sort on. */ function tablesort_get_order($headers) { - $order = Drupal::request()->query->get('order', ''); + $order = \Drupal::request()->query->get('order', ''); foreach ($headers as $header) { if (is_array($header)) { if (isset($header['data']) && $order == $header['data']) { @@ -151,7 +151,7 @@ function tablesort_get_order($headers) { * The current sort direction ("asc" or "desc"). */ function tablesort_get_sort($headers) { - $query = Drupal::request()->query; + $query = \Drupal::request()->query; if ($query->has('sort')) { return (strtolower($query->get('sort')) == 'desc') ? 'desc' : 'asc'; } diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 5e12ff5..6c240c7 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -97,7 +97,7 @@ function drupal_theme_initialize() { // Only select the user selected theme if it is available in the // list of themes that can be accessed. - $theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : Drupal::config('system.theme')->get('default'); + $theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : \Drupal::config('system.theme')->get('default'); // Allow modules to override the theme. Validation has already been performed // inside menu_get_custom_theme(), so we do not need to check it again here. @@ -372,14 +372,14 @@ function _theme_load_registry($theme, $base_theme = NULL, $theme_engine = NULL, $registry = _theme_build_registry($theme, $base_theme, $theme_engine); // Only persist this registry if all modules are loaded. This assures a // complete set of theme hooks. - if (Drupal::moduleHandler()->isLoaded()) { + if (\Drupal::moduleHandler()->isLoaded()) { _theme_save_registry($theme, $registry); } } return $registry; } else { - return new ThemeRegistry('theme_registry:runtime:' . $theme->name, 'cache', array('theme_registry' => TRUE), Drupal::moduleHandler()->isLoaded()); + return new ThemeRegistry('theme_registry:runtime:' . $theme->name, 'cache', array('theme_registry' => TRUE), \Drupal::moduleHandler()->isLoaded()); } } @@ -457,7 +457,7 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { 'base hook' => TRUE, ); - $module_list = array_keys(Drupal::moduleHandler()->getModuleList()); + $module_list = array_keys(\Drupal::moduleHandler()->getModuleList()); // Invoke the hook_theme() implementation, preprocess what is returned, and // merge it into $cache. @@ -610,11 +610,11 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) { $cache = $cached->data; } else { - foreach (Drupal::moduleHandler()->getImplementations('theme') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('theme') as $module) { _theme_process_registry($cache, $module, 'module', $module, drupal_get_path('module', $module)); } // Only cache this registry if all modules are loaded. - if (Drupal::moduleHandler()->isLoaded()) { + if (\Drupal::moduleHandler()->isLoaded()) { cache()->set("theme_registry:build:modules", $cache, CacheBackendInterface::CACHE_PERMANENT, array('theme_registry' => TRUE)); } } @@ -914,7 +914,7 @@ function theme($hook, $variables = array()) { // If called before all modules are loaded, we do not necessarily have a full // theme registry to work with, and therefore cannot process the theme // request properly. See also _theme_load_registry(). - if (!Drupal::moduleHandler()->isLoaded() && !defined('MAINTENANCE_MODE')) { + if (!\Drupal::moduleHandler()->isLoaded() && !defined('MAINTENANCE_MODE')) { throw new Exception(t('theme() may not be called until all modules are loaded.')); } @@ -1363,11 +1363,11 @@ function theme_get_setting($setting_name, $theme = NULL) { } // Get the global settings from configuration. - $cache[$theme]->mergeData(Drupal::config('system.theme.global')->get()); + $cache[$theme]->mergeData(\Drupal::config('system.theme.global')->get()); if ($theme) { // Get the saved theme-specific settings from the configuration system. - $cache[$theme]->mergeData(Drupal::config($theme . '.settings')->get()); + $cache[$theme]->mergeData(\Drupal::config($theme . '.settings')->get()); // If the theme does not support a particular feature, override the global // setting and set the value to NULL. @@ -1464,8 +1464,8 @@ function theme_settings_convert_to_config(array $theme_settings, Config $config) */ function theme_enable($theme_list) { drupal_clear_css_cache(); - $theme_config = Drupal::config('system.theme'); - $disabled_themes = Drupal::config('system.theme.disabled'); + $theme_config = \Drupal::config('system.theme'); + $disabled_themes = \Drupal::config('system.theme.disabled'); foreach ($theme_list as $key) { // Throw an exception if the theme name is too long. if (strlen($key) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) { @@ -1486,12 +1486,12 @@ function theme_enable($theme_list) { config_install_default_config('theme', $key); } - Drupal::service('router.builder')->rebuild(); + \Drupal::service('router.builder')->rebuild(); menu_router_rebuild(); drupal_theme_rebuild(); // Invoke hook_themes_enabled() after the themes have been enabled. - Drupal::moduleHandler()->invokeAll('themes_enabled', array($theme_list)); + \Drupal::moduleHandler()->invokeAll('themes_enabled', array($theme_list)); } /** @@ -1502,7 +1502,7 @@ function theme_enable($theme_list) { */ function theme_disable($theme_list) { // Don't disable the default theme. - if ($pos = array_search(Drupal::config('system.theme')->get('default'), $theme_list) !== FALSE) { + if ($pos = array_search(\Drupal::config('system.theme')->get('default'), $theme_list) !== FALSE) { unset($theme_list[$pos]); if (empty($theme_list)) { return; @@ -1511,8 +1511,8 @@ function theme_disable($theme_list) { drupal_clear_css_cache(); - $theme_config = Drupal::config('system.theme'); - $disabled_themes = Drupal::config('system.theme.disabled'); + $theme_config = \Drupal::config('system.theme'); + $disabled_themes = \Drupal::config('system.theme.disabled'); foreach ($theme_list as $key) { // The value is not used; the weight is ignored for themes currently. $theme_config->clear("enabled.$key"); @@ -1522,12 +1522,12 @@ function theme_disable($theme_list) { $disabled_themes->save(); list_themes(TRUE); - Drupal::service('router.builder')->rebuild(); + \Drupal::service('router.builder')->rebuild(); menu_router_rebuild(); drupal_theme_rebuild(); // Invoke hook_themes_disabled after the themes have been disabled. - Drupal::moduleHandler()->invokeAll('themes_disabled', array($theme_list)); + \Drupal::moduleHandler()->invokeAll('themes_disabled', array($theme_list)); } /** @@ -2564,7 +2564,7 @@ function template_preprocess_html(&$variables) { drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type)); } - $site_config = Drupal::config('system.site'); + $site_config = \Drupal::config('system.site'); // Construct page title. if (isset($variables['page']['#title'])) { $head_title = array( @@ -2663,7 +2663,7 @@ function template_preprocess_html(&$variables) { */ function template_preprocess_page(&$variables) { $language_interface = language(Language::TYPE_INTERFACE); - $site_config = Drupal::config('system.site'); + $site_config = \Drupal::config('system.site'); // Move some variables to the top level for themer convenience and template cleanliness. $variables['show_messages'] = $variables['page']['#show_messages']; @@ -2866,7 +2866,7 @@ function template_preprocess_maintenance_page(&$variables) { $variables['layout'] = ($variables['layout'] == 'first') ? 'both' : 'second'; } - $site_config = Drupal::config('system.site'); + $site_config = \Drupal::config('system.site'); $site_name = $site_config->get('name'); $site_slogan = $site_config->get('slogan'); diff --git a/core/includes/theme.maintenance.inc b/core/includes/theme.maintenance.inc index 5c35ac3..5a22dd1 100644 --- a/core/includes/theme.maintenance.inc +++ b/core/includes/theme.maintenance.inc @@ -54,7 +54,7 @@ function _drupal_maintenance_theme() { // otherwise, as it looks generic enough and way more user-friendly. $custom_theme = variable_get('maintenance_theme'); if (!$custom_theme) { - $config = Drupal::config('system.theme'); + $config = \Drupal::config('system.theme'); // A broken install might not return an object. if (is_object($config)) { $custom_theme = $config->get('default'); @@ -68,7 +68,7 @@ function _drupal_maintenance_theme() { // Ensure that system.module is loaded. if (!function_exists('_system_rebuild_theme_data')) { $module_list['system'] = 'core/modules/system/system.module'; - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); $module_handler->setModuleList($module_list); $module_handler->load('system'); } diff --git a/core/includes/update.inc b/core/includes/update.inc index 0808cfc..a8c4109 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -32,7 +32,7 @@ */ function update_fix_compatibility() { foreach (array('module', 'theme') as $type) { - $config = Drupal::config("system.$type"); + $config = \Drupal::config("system.$type"); $save = FALSE; foreach ($config->get('enabled') as $name => $weight) { if (update_check_incompatibility($name, $type)) { @@ -72,7 +72,7 @@ function update_check_incompatibility($name, $type = 'module') { } if (!isset($file) || !isset($file->info['core']) - || $file->info['core'] != Drupal::CORE_COMPATIBILITY + || $file->info['core'] != \Drupal::CORE_COMPATIBILITY || version_compare(phpversion(), $file->info['php']) < 0) { return TRUE; } @@ -334,11 +334,11 @@ function update_prepare_d8_bootstrap() { variable_set('language_default', (array) $language_default); } - $module_config = Drupal::config('system.module'); - $disabled_modules = Drupal::config('system.module.disabled'); - $theme_config = Drupal::config('system.theme'); - $disabled_themes = Drupal::config('system.theme.disabled'); - $schema_store = Drupal::keyValue('system.schema'); + $module_config = \Drupal::config('system.module'); + $disabled_modules = \Drupal::config('system.module.disabled'); + $theme_config = \Drupal::config('system.theme'); + $disabled_themes = \Drupal::config('system.theme.disabled'); + $schema_store = \Drupal::keyValue('system.schema'); // Load system.module, because update_prepare_d8_bootstrap() is called in // the initial minimal update.php bootstrap that performs the core @@ -398,7 +398,7 @@ function update_prepare_d8_bootstrap() { foreach (array_keys($sorted_modules) as $m) { $sorted_with_filenames[$m] = drupal_get_filename('module', $m); } - Drupal::moduleHandler()->setModuleList($sorted_with_filenames); + \Drupal::moduleHandler()->setModuleList($sorted_with_filenames); $disabled_modules->save(); $theme_config->save(); $disabled_themes->save(); @@ -416,7 +416,7 @@ function update_prepare_d8_bootstrap() { update_prepare_d8_language(); // Rebuild kernel after new language fields are added in the database // because the translation service depends on them being there. - Drupal::service('kernel')->updateModules($sorted_with_filenames, $sorted_with_filenames); + \Drupal::service('kernel')->updateModules($sorted_with_filenames, $sorted_with_filenames); // Change language column to langcode in url_alias. if (db_table_exists('url_alias') && db_field_exists('url_alias', 'language')) { @@ -444,7 +444,7 @@ function update_prepare_d8_bootstrap() { // directly. Check that it has not been set already. This is the case for // Simpletest upgrade path tests. if (!settings()->get('install_profile')) { - $old_variable = unserialize(Drupal::database()->query('SELECT value FROM {variable} WHERE name = :name', array(':name' => 'install_profile'))->fetchField()); + $old_variable = unserialize(\Drupal::database()->query('SELECT value FROM {variable} WHERE name = :name', array(':name' => 'install_profile'))->fetchField()); $settings = array( 'settings' => array( 'install_profile' => (object) array( @@ -509,9 +509,9 @@ function update_prepare_d8_language() { $prefixes[$language->language] = $language->prefix; $domains[$language->language] = $language->domain; } - Drupal::state()->set('locale.translation.plurals', $plurals); - Drupal::state()->set('locale.translation.javascript', $javascript); - Drupal::config('language.negotiation') + \Drupal::state()->set('locale.translation.plurals', $plurals); + \Drupal::state()->set('locale.translation.javascript', $javascript); + \Drupal::config('language.negotiation') ->set('url.prefixes', $prefixes) ->set('url.domains', $domains) ->save(); @@ -526,7 +526,7 @@ function update_prepare_d8_language() { db_drop_field('languages', 'enabled'); // Update language count. - Drupal::state()->set('language_count', db_query('SELECT COUNT(language) FROM {languages}')->fetchField()); + \Drupal::state()->set('language_count', db_query('SELECT COUNT(language) FROM {languages}')->fetchField()); // Rename the languages table to language. db_rename_table('languages', 'language'); @@ -590,7 +590,7 @@ function update_prepare_d8_language() { $result = db_query('SELECT * FROM {language}'); $uuid = new Uuid(); foreach ($result as $language) { - Drupal::config('language.entity.' . $language->langcode) + \Drupal::config('language.entity.' . $language->langcode) ->set('id', $language->langcode) ->set('uuid', $uuid->generate()) ->set('label', $language->name) @@ -727,7 +727,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(). module_enable(array('views')); update_variable_set('update_d8_requirements', TRUE); @@ -745,7 +745,7 @@ function update_fix_d8_requirements() { * The schema version the module should be set to. */ function update_set_schema($module, $schema_version) { - Drupal::keyValue('system.schema')->set($module, $schema_version); + \Drupal::keyValue('system.schema')->set($module, $schema_version); // system_list_reset() is in module.inc but that would only be available // once the variable bootstrap is done. require_once __DIR__ . '/module.inc'; @@ -875,13 +875,13 @@ function update_do_one($module, $number, $dependency_map, &$context) { function update_batch($start, $redirect = NULL, $url = NULL, $batch = array(), $redirect_callback = NULL) { // During the update, bring the site offline so that schema changes do not // affect visiting users. - $maintenance_mode = Drupal::config('system.maintenance')->get('enabled'); + $maintenance_mode = \Drupal::config('system.maintenance')->get('enabled'); if (isset($maintenance_mode)) { $_SESSION['maintenance_mode'] = $maintenance_mode; } if (empty($_SESSION['maintenance_mode'])) { if (db_table_exists('state')) { - Drupal::state()->set('system.maintenance_mode', TRUE); + \Drupal::state()->set('system.maintenance_mode', TRUE); } } @@ -953,7 +953,7 @@ function update_finished($success, $results, $operations) { // Now that the update is done, we can put the site back online if it was // previously in maintenance mode. if (isset($_SESSION['maintenance_mode'])) { - Drupal::state()->set('system.maintenance_mode', FALSE); + \Drupal::state()->set('system.maintenance_mode', FALSE); unset($_SESSION['maintenance_mode']); } } @@ -1273,7 +1273,7 @@ function update_retrieve_dependencies() { $return = array(); // Get a list of installed modules, arranged so that we invoke their hooks in // the same order that \Drupal::moduleHandler()->invokeAll() does. - foreach (Drupal::keyValue('system.schema')->getAll() as $module => $schema) { + foreach (\Drupal::keyValue('system.schema')->getAll() as $module => $schema) { if ($schema == SCHEMA_UNINSTALLED) { // Nothing to upgrade. continue; @@ -1417,7 +1417,7 @@ function update_variables_to_config($config_name, array $variable_map) { // Build the new configuration object. // This potentially loads an existing configuration object, in case another // update function migrated configuration values into $config_name already. - $config = Drupal::config($config_name); + $config = \Drupal::config($config_name); $original_data = $config->get(); // Extract the module namespace/owner from the configuration object name. @@ -1447,7 +1447,7 @@ function update_variables_to_config($config_name, array $variable_map) { // This function migrates variables regardless of their value, including // NULL values. Any possibly required customizations need to be performed // manually, either via variable_set() before calling this function or via - // Drupal::config() after calling this function. + // \Drupal::config() after calling this function. if (isset($variables[$variable_name])) { $value = unserialize($variables[$variable_name]); $config->set($config_key, $value); @@ -1481,7 +1481,7 @@ function update_variables_to_config($config_name, array $variable_map) { */ function update_install_default_config($type, $config_name, $name = NULL) { // Build the new configuration object. - $config = Drupal::config($config_name); + $config = \Drupal::config($config_name); // Extract the extension namespace/owner from the configuration object name. if (!$name) { @@ -1503,7 +1503,7 @@ function update_install_default_config($type, $config_name, $name = NULL) { * Updates 7.x variables to state records. * * Provides a generalized method to migrate variables from 7.x to 8.x's - * Drupal::state() system. + * \Drupal::state() system. * * @param array $variable_map * An associative array that maps old variables names to new state record @@ -1518,7 +1518,7 @@ function update_install_default_config($type, $config_name, $name = NULL) { function update_variables_to_state(array $variable_map) { foreach ($variable_map as $variable_name => $state_name) { if (NULL !== $value = update_variable_get($variable_name)) { - Drupal::state()->set($state_name, $value); + \Drupal::state()->set($state_name, $value); } } @@ -1599,10 +1599,10 @@ function update_add_cache_columns($table) { function update_replace_permissions($replace) { $prefix = 'user.role.'; $cut = strlen($prefix); - $role_names = Drupal::service('config.storage')->listAll($prefix); + $role_names = \Drupal::service('config.storage')->listAll($prefix); foreach ($role_names as $role_name) { $rid = substr($role_name, $cut); - $config = Drupal::config("user.role.$rid"); + $config = \Drupal::config("user.role.$rid"); $permissions = $config->get('permissions') ?: array(); foreach ($replace as $old_permission => $new_permissions) { if (($index = array_search($old_permission, $permissions)) !== FALSE) { @@ -1648,7 +1648,7 @@ function update_language_list($flags = Language::STATE_CONFIGURABLE) { // save the same object without data loss. foreach ($language_entities as $langcode_config_name) { $langcode = substr($langcode_config_name, strlen('language.entity.')); - $info = Drupal::config($langcode_config_name)->get(); + $info = \Drupal::config($langcode_config_name)->get(); $languages[$langcode] = new Language(array( 'default' => ($info['id'] == $default->id), 'name' => $info['label'], diff --git a/core/lib/Drupal.php b/core/lib/Drupal.php index 0703c06..39211f5 100644 --- a/core/lib/Drupal.php +++ b/core/lib/Drupal.php @@ -37,21 +37,21 @@ * * // Correct procedural code. * function hook_do_stuff() { - * $lock = Drupal::lock()->acquire('stuff_lock'); + * $lock = \Drupal::lock()->acquire('stuff_lock'); * // ... * } * * // The preferred way: dependency injected code. * function hook_do_stuff() { * // Move the actual implementation to a class and instantiate it. - * $instance = new StuffDoingClass(Drupal::lock()); + * $instance = new StuffDoingClass(\Drupal::lock()); * $instance->doStuff(); * * // Or, even better, rely on the service container to avoid hard coding a * // specific interface implementation, so that the actual logic can be * // swapped. This might not always make sense, but in general it is a good * // practice. - * Drupal::service('stuff.doing')->doStuff(); + * \Drupal::service('stuff.doing')->doStuff(); * } * * interface StuffDoingInterface { @@ -455,7 +455,7 @@ public static function linkGenerator() { * However, for links enclosed in translatable text you should use t() and * embed the HTML anchor tag directly in the translated string. For example: * @code - * t('Visit the content types page', array('@url' => Drupal::url('node_overview_types'))); + * t('Visit the content types page', array('@url' => \Drupal::url('node_overview_types'))); * @endcode * This keeps the context of the link title ('settings' in the example) for * translators. diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php index c016093..3ab46aa 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php @@ -1094,7 +1094,7 @@ static public function _fieldTableName(FieldInterface $field) { * @private Calling this function circumvents the entity system and is * strongly discouraged. This function is not considered part of the public * API and modules relying on it might break even in minor releases. Only - * call this function to write a query that Drupal::entityQuery() does not + * call this function to write a query that \Drupal::entityQuery() does not * support. Always call entity_load() before using the data found in the * table. * diff --git a/core/lib/Drupal/Core/Entity/EntityManager.php b/core/lib/Drupal/Core/Entity/EntityManager.php index fc45202..4a2f244 100644 --- a/core/lib/Drupal/Core/Entity/EntityManager.php +++ b/core/lib/Drupal/Core/Entity/EntityManager.php @@ -374,7 +374,7 @@ protected function getController($entity_type, $controller_type) { * langcode. Defaults to an empty array. * @code * $form_state['langcode'] = $langcode; - * $manager = Drupal::entityManager(); + * $manager = \Drupal::entityManager(); * $form = $manager->getForm($entity, 'default', $form_state); * @endcode * diff --git a/core/lib/Drupal/Core/Entity/Query/QueryInterface.php b/core/lib/Drupal/Core/Entity/Query/QueryInterface.php index 3a02e8e..3c2682c 100644 --- a/core/lib/Drupal/Core/Entity/Query/QueryInterface.php +++ b/core/lib/Drupal/Core/Entity/Query/QueryInterface.php @@ -38,7 +38,7 @@ public function getEntityType(); * For example, to find all entities containing both the Turkish 'merhaba' * and the Polish 'siema' within a 'greetings' text field: * @code - * $entity_ids = Drupal::entityQuery($entity_type) + * $entity_ids = \Drupal::entityQuery($entity_type) * ->condition('greetings', 'merhaba', '=', 'tr'); * ->condition('greetings.value', 'siema', '=', 'pl'); * ->execute(); @@ -186,7 +186,7 @@ public function execute(); * field containing 'shape' and 'color' columns. To find all drawings * containing both a red triangle and a blue circle: * @code - * $query = Drupal::entityQuery('drawing'); + * $query = \Drupal::entityQuery('drawing'); * $group = $query->andConditionGroup() * ->condition('figures.color', 'red') * ->condition('figures.shape', 'triangle'); @@ -209,7 +209,7 @@ public function andConditionGroup(); * containing 'building_type' and 'color' columns. To find all green and * red bikesheds: * @code - * $query = Drupal::entityQuery('map'); + * $query = \Drupal::entityQuery('map'); * $group = $query->orConditionGroup() * ->condition('attributes.color', 'red') * ->condition('attributes.color', 'green'); diff --git a/core/lib/Drupal/Core/Extension/CachedModuleHandler.php b/core/lib/Drupal/Core/Extension/CachedModuleHandler.php index 295cead..6e09432 100644 --- a/core/lib/Drupal/Core/Extension/CachedModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/CachedModuleHandler.php @@ -81,7 +81,7 @@ public function resetImplementations() { // $this->bootstrapCache->get() is more or less constant and reduced further when // non-database caching backends are used, so there will be more significant // gains when a large number of modules are installed or hooks invoked, since - // this can quickly lead to Drupal::moduleHandler()->implementsHook() being + // this can quickly lead to \Drupal::moduleHandler()->implementsHook() being // called several thousand times per request. parent::resetImplementations(); $this->bootstrapCache->set('module_implements', array()); @@ -121,7 +121,7 @@ protected function getImplementationInfo($hook) { // It is possible that a module removed a hook implementation without the // implementations cache being rebuilt yet, so we check whether the // function exists on each request to avoid undefined function errors. - // Since Drupal::moduleHandler()->implementsHook() may needlessly try to + // Since \Drupal::moduleHandler()->implementsHook() may needlessly try to // load the include file again, function_exists() is used directly here. if (!function_exists($module . '_' . $hook)) { // Clear out the stale implementation from the cache and force a cache diff --git a/core/lib/Drupal/Core/Utility/LinkGeneratorInterface.php b/core/lib/Drupal/Core/Utility/LinkGeneratorInterface.php index dba34cd..1e24854 100644 --- a/core/lib/Drupal/Core/Utility/LinkGeneratorInterface.php +++ b/core/lib/Drupal/Core/Utility/LinkGeneratorInterface.php @@ -22,7 +22,7 @@ * However, for links enclosed in translatable text you should use t() and * embed the HTML anchor tag directly in the translated string. For example: * @code - * t('Visit the content types page', array('@url' => Drupal::url('node_overview_types'))); + * t('Visit the content types page', array('@url' => \Drupal::url('node_overview_types'))); * @endcode * This keeps the context of the link title ('settings' in the example) for * translators. diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module index 041a0f8..0619512 100644 --- a/core/modules/aggregator/aggregator.module +++ b/core/modules/aggregator/aggregator.module @@ -246,7 +246,7 @@ function aggregator_cron() { ':time' => REQUEST_TIME, ':never' => AGGREGATOR_CLEAR_NEVER )); - $queue = Drupal::queue('aggregator_feeds'); + $queue = \Drupal::queue('aggregator_feeds'); foreach ($result->fetchCol() as $fid) { $feed = aggregator_feed_load($fid); if ($queue->createItem($feed)) { @@ -302,7 +302,7 @@ function aggregator_save_category($edit) { ->condition('cid', $edit['cid']) ->execute(); // Make sure there is no active block for this category. - if (Drupal::moduleHandler()->moduleExists('block')) { + if (\Drupal::moduleHandler()->moduleExists('block')) { foreach (entity_load_multiple_by_properties('block', array('plugin' => 'aggregator_category_block:' . $edit['cid'])) as $block) { $block->delete(); } @@ -322,7 +322,7 @@ function aggregator_save_category($edit) { ->execute(); $op = 'insert'; } - if (isset($op) && Drupal::moduleHandler()->moduleExists('menu_link')) { + if (isset($op) && \Drupal::moduleHandler()->moduleExists('menu_link')) { menu_link_maintain('aggregator', $op, $link_path, $edit['title']); } } @@ -337,9 +337,9 @@ function aggregator_refresh(Feed $feed) { // Store feed URL to track changes. $feed_url = $feed->url->value; - $config = Drupal::config('aggregator.settings'); + $config = \Drupal::config('aggregator.settings'); // Fetch the feed. - $fetcher_manager = Drupal::service('plugin.manager.aggregator.fetcher'); + $fetcher_manager = \Drupal::service('plugin.manager.aggregator.fetcher'); try { $success = $fetcher_manager->createInstance($config->get('fetcher'))->fetch($feed); } @@ -349,7 +349,7 @@ function aggregator_refresh(Feed $feed) { } // Retrieve processor manager now. - $processor_manager = Drupal::service('plugin.manager.aggregator.processor'); + $processor_manager = \Drupal::service('plugin.manager.aggregator.processor'); // Store instances in an array so we dont have to instantiate new objects. $processor_instances = array(); foreach ($config->get('processors') as $processor) { @@ -368,7 +368,7 @@ function aggregator_refresh(Feed $feed) { if ($success && ($feed->hash->value != $hash)) { // Parse the feed. - $parser_manager = Drupal::service('plugin.manager.aggregator.parser'); + $parser_manager = \Drupal::service('plugin.manager.aggregator.parser'); try { if ($parser_manager->createInstance($config->get('parser'))->parse($feed)) { if (empty($feed->link->value)) { @@ -439,7 +439,7 @@ function aggregator_feed_load($fid) { * instead. */ function aggregator_category_load($cid) { - return Drupal::service('aggregator.category.storage')->load($cid); + return \Drupal::service('aggregator.category.storage')->load($cid); } /** @@ -467,7 +467,7 @@ function theme_aggregator_block_item($variables) { * The filtered content. */ function aggregator_filter_xss($value) { - return filter_xss($value, preg_split('/\s+|<|>/', Drupal::config('aggregator.settings')->get('items.allowed_html'), -1, PREG_SPLIT_NO_EMPTY)); + return filter_xss($value, preg_split('/\s+|<|>/', \Drupal::config('aggregator.settings')->get('items.allowed_html'), -1, PREG_SPLIT_NO_EMPTY)); } /** diff --git a/core/modules/aggregator/aggregator.pages.inc b/core/modules/aggregator/aggregator.pages.inc index 2a8e5f7..57e2b5c 100644 --- a/core/modules/aggregator/aggregator.pages.inc +++ b/core/modules/aggregator/aggregator.pages.inc @@ -37,7 +37,7 @@ * An array of the feed items. */ function aggregator_load_feed_items($type, $data = NULL, $limit = 20) { - $storage_controller = Drupal::entityManager()->getStorageController('aggregator_item'); + $storage_controller = \Drupal::entityManager()->getStorageController('aggregator_item'); switch ($type) { case 'sum': return $storage_controller->loadAll($limit); @@ -148,7 +148,7 @@ function theme_aggregator_page_opml($variables) { $output = "\n"; $output .= "\n"; $output .= "\n"; - $output .= '' . check_plain(Drupal::config('system.site')->get('name')) . "\n"; + $output .= '' . check_plain(\Drupal::config('system.site')->get('name')) . "\n"; $output .= '' . gmdate(DATE_RFC2822, REQUEST_TIME) . "\n"; $output .= "\n"; $output .= "\n"; diff --git a/core/modules/block/block.module b/core/modules/block/block.module index 8fa59ea..67fe1fa 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -56,7 +56,7 @@ function block_help($path, $arg) { $demo_theme = $arg[4]; } else { - $demo_theme = Drupal::config('system.theme')->get('default'); + $demo_theme = \Drupal::config('system.theme')->get('default'); } $themes = list_themes(); $output = '

' . t('This page provides a drag-and-drop interface for adding a block to a region, and for controlling the order of blocks within regions. To add a block to a region, or to configure its specific title and visibility settings, click the block title under Place blocks. Since not all themes implement the same regions, or display regions in the same way, blocks are positioned on a per-theme basis. Remember that your changes will not be saved until you click the Save blocks button at the bottom of the page.') . '

'; @@ -98,7 +98,7 @@ function block_permission() { * @todo Clarify the documentation for the per-plugin block admin links. */ function block_menu() { - $default_theme = Drupal::config('system.theme')->get('default'); + $default_theme = \Drupal::config('system.theme')->get('default'); $items['admin/structure/block'] = array( 'title' => 'Block layout', 'description' => 'Configure what block content appears in your site\'s sidebars and other regions.', @@ -236,7 +236,7 @@ function block_page_build(&$page) { $page['page_top']['backlink'] = array( '#type' => 'link', '#title' => t('Exit block region demonstration'), - '#href' => 'admin/structure/block' . (Drupal::config('system.theme')->get('default') == $theme ? '' : '/list/' . $theme), + '#href' => 'admin/structure/block' . (\Drupal::config('system.theme')->get('default') == $theme ? '' : '/list/' . $theme), // Add the "overlay-restore" class to indicate this link should restore // the context in which the region demonstration page was opened. '#options' => array('attributes' => array('class' => array('block-demo-backlink', 'overlay-restore'))), @@ -279,9 +279,9 @@ function _block_get_renderable_region($list = array()) { // the regular 'roles define permissions' schema, it brings too many // chances of having unwanted output get in the cache and later be served // to other users. We therefore exclude user 1 from block caching. - $not_cacheable = Drupal::currentUser()->id() == 1 || - count(Drupal::moduleHandler()->getImplementations('node_grants')) || - !Drupal::request()->isMethodSafe(); + $not_cacheable = \Drupal::currentUser()->id() == 1 || + count(\Drupal::moduleHandler()->getImplementations('node_grants')) || + !\Drupal::request()->isMethodSafe(); foreach ($list as $key => $block) { $settings = $block->get('settings'); @@ -336,7 +336,7 @@ function _block_get_renderable_region($list = array()) { * Blocks currently exported by modules. */ function _block_rehash($theme = NULL) { - $theme = $theme ? $theme : Drupal::config('system.theme')->get('default'); + $theme = $theme ? $theme : \Drupal::config('system.theme')->get('default'); $regions = system_region_list($theme); $blocks = entity_load_multiple_by_properties('block', array('theme' => $theme)); foreach ($blocks as $block_id => $block) { @@ -385,7 +385,7 @@ function block_theme_initialize($theme) { // Initialize theme's blocks if none already registered. $has_blocks = entity_load_multiple_by_properties('block', array('theme' => $theme)); if (!$has_blocks) { - $default_theme = Drupal::config('system.theme')->get('default'); + $default_theme = \Drupal::config('system.theme')->get('default'); // Apply only to new theme's visible regions. $regions = system_region_list($theme, REGIONS_VISIBLE); $default_theme_blocks = entity_load_multiple_by_properties('block', array('theme' => $default_theme)); @@ -615,7 +615,7 @@ function block_language_delete($language) { function block_library_info() { $libraries['drupal.block'] = array( 'title' => 'Block', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'block') . '/block.js' => array(), ), @@ -626,7 +626,7 @@ function block_library_info() { ); $libraries['drupal.block.admin'] = array( 'title' => 'Block admin', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'block') . '/js/block.admin.js' => array(), ), diff --git a/core/modules/block/custom_block/custom_block.module b/core/modules/block/custom_block/custom_block.module index 4ebc5cb..70dcf1c 100644 --- a/core/modules/block/custom_block/custom_block.module +++ b/core/modules/block/custom_block/custom_block.module @@ -189,7 +189,7 @@ function custom_block_entity_info_alter(&$types) { function custom_block_entity_bundle_info() { $bundles = array(); foreach (config_get_storage_names_with_prefix('custom_block.type.') as $config_name) { - $config = Drupal::config($config_name); + $config = \Drupal::config($config_name); $bundles['custom_block'][$config->get('id')]['label'] = $config->get('label'); } return $bundles; diff --git a/core/modules/block/custom_block/custom_block.pages.inc b/core/modules/block/custom_block/custom_block.pages.inc index a1a3cac..61bbf31 100644 --- a/core/modules/block/custom_block/custom_block.pages.inc +++ b/core/modules/block/custom_block/custom_block.pages.inc @@ -22,10 +22,10 @@ */ function template_preprocess_custom_block_add_list(&$variables) { $variables['types'] = array(); - $query = Drupal::request()->query->all(); + $query = \Drupal::request()->query->all(); foreach ($variables['content'] as $type) { $variables['types'][$type->id()] = array( - 'link' => Drupal::l($type->label(), 'custom_block_add_form', array('custom_block_type' => $type->id()), array('query' => $query)), + 'link' => \Drupal::l($type->label(), 'custom_block_add_form', array('custom_block_type' => $type->id()), array('query' => $query)), 'description' => filter_xss_admin($type->description), 'title' => $type->label(), 'localized_options' => array( diff --git a/core/modules/block/tests/modules/block_test/block_test.module b/core/modules/block/tests/modules/block_test/block_test.module index 5184454..4370202 100644 --- a/core/modules/block/tests/modules/block_test/block_test.module +++ b/core/modules/block/tests/modules/block_test/block_test.module @@ -17,7 +17,7 @@ function block_test_system_theme_info() { * Implements hook_block_alter(). */ function block_test_block_alter(&$block_info) { - if (Drupal::state()->get('block_test_info_alter') && isset($block_info['test_block_instantiation'])) { + if (\Drupal::state()->get('block_test_info_alter') && isset($block_info['test_block_instantiation'])) { $block_info['test_block_instantiation']['category'] = t('Custom category'); } } diff --git a/core/modules/book/book.admin.inc b/core/modules/book/book.admin.inc index 09261f2..1d7061b 100644 --- a/core/modules/book/book.admin.inc +++ b/core/modules/book/book.admin.inc @@ -29,7 +29,7 @@ function theme_book_admin_table($variables) { $rows = array(); $destination = drupal_get_destination(); - $access = Drupal::currentUser()->hasPermission('administer nodes'); + $access = \Drupal::currentUser()->hasPermission('administer nodes'); foreach (element_children($form) as $key) { $nid = $form[$key]['nid']['#value']; $href = $form[$key]['href']['#value']; diff --git a/core/modules/book/book.install b/core/modules/book/book.install index 786a1cf..fb8c225 100644 --- a/core/modules/book/book.install +++ b/core/modules/book/book.install @@ -73,7 +73,7 @@ function book_update_8000() { // @see book_admin_settings_submit() sort($allowed_types); - Drupal::config('book.settings') + \Drupal::config('book.settings') ->set('allowed_types', $allowed_types) ->save(); } diff --git a/core/modules/book/book.module b/core/modules/book/book.module index 6f56b97..7a1a286 100644 --- a/core/modules/book/book.module +++ b/core/modules/book/book.module @@ -130,11 +130,11 @@ function book_entity_info(&$entity_info) { */ function book_node_view_link(NodeInterface $node, $view_mode) { $links = array(); - $account = Drupal::currentUser(); + $account = \Drupal::currentUser(); if (isset($node->book['depth'])) { if ($view_mode == 'full' && node_is_page($node)) { - $child_type = Drupal::config('book.settings')->get('child_type'); + $child_type = \Drupal::config('book.settings')->get('child_type'); if (($account->hasPermission('add content to books') || $account->hasPermission('administer book outlines')) && node_access('create', $child_type) && $node->isPublished() && $node->book['depth'] < MENU_MAX_DEPTH) { $links['book_add_child'] = array( 'title' => t('Add child page'), @@ -218,7 +218,7 @@ function book_menu() { * @see book_menu() */ function _book_outline_access(EntityInterface $node) { - return Drupal::currentUser()->hasPermission('administer book outlines') && node_access('view', $node); + return \Drupal::currentUser()->hasPermission('administer book outlines') && node_access('view', $node); } /** @@ -230,7 +230,7 @@ function _book_outline_access(EntityInterface $node) { * @see book_menu() */ function _book_outline_remove_access(EntityInterface $node) { - return Drupal::service('book.manager')->checkNodeIsRemovable($node) + return \Drupal::service('book.manager')->checkNodeIsRemovable($node) && _book_outline_access($node); } @@ -238,7 +238,7 @@ function _book_outline_remove_access(EntityInterface $node) { * Implements hook_admin_paths(). */ function book_admin_paths() { - if (Drupal::config('node.settings')->get('use_admin_theme')) { + if (\Drupal::config('node.settings')->get('use_admin_theme')) { $paths = array( 'node/*/outline' => TRUE, 'node/*/outline/remove' => TRUE, @@ -259,7 +259,7 @@ function book_admin_paths() { * An array of all books. */ function book_get_books() { - return Drupal::service('book.manager')->getAllBooks(); + return \Drupal::service('book.manager')->getAllBooks(); } /** @@ -271,7 +271,7 @@ function book_get_books() { */ function book_form_node_form_alter(&$form, &$form_state, $form_id) { $node = $form_state['controller']->getEntity(); - $account = Drupal::currentUser(); + $account = \Drupal::currentUser(); $access = $account->hasPermission('administer book outlines'); if (!$access) { if ($account->hasPermission('add content to books') && ((!empty($node->book['mlid']) && !$node->isNew()) || book_type_is_allowed($node->getType()))) { @@ -281,7 +281,7 @@ function book_form_node_form_alter(&$form, &$form_state, $form_id) { } if ($access) { - $form = Drupal::service('book.manager')->addFormElements($form, $form_state, $node, $account); + $form = \Drupal::service('book.manager')->addFormElements($form, $form_state, $node, $account); // Since the "Book" dropdown can't trigger a form submission when // JavaScript is disabled, add a submit button to do that. book.admin.css hides // this button when JavaScript is enabled. @@ -541,7 +541,7 @@ function book_page_alter(&$page) { */ function book_node_presave(EntityInterface $node) { // Always save a revision for non-administrators. - if (!empty($node->book['bid']) && !Drupal::currentUser()->hasPermission('administer nodes')) { + if (!empty($node->book['bid']) && !\Drupal::currentUser()->hasPermission('administer nodes')) { $node->setNewRevision(); } // Make sure a new node gets a new menu link. @@ -554,7 +554,7 @@ function book_node_presave(EntityInterface $node) { * Implements hook_node_insert(). */ function book_node_insert(EntityInterface $node) { - $book_manager = Drupal::service('book.manager'); + $book_manager = \Drupal::service('book.manager'); if (!empty($node->book['bid'])) { if ($node->book['bid'] == 'new') { // New nodes that are their own book. @@ -570,7 +570,7 @@ function book_node_insert(EntityInterface $node) { * Implements hook_node_update(). */ function book_node_update(EntityInterface $node) { - $book_manager = Drupal::service('book.manager'); + $book_manager = \Drupal::service('book.manager'); if (!empty($node->book['bid'])) { if ($node->book['bid'] == 'new') { // New nodes that are their own book. @@ -595,7 +595,7 @@ function book_node_predelete(EntityInterface $node) { foreach ($result as $child) { $child_node = node_load($child->id()); $child_node->book['bid'] = $child_node->id(); - Drupal::service('book.manager')->updateOutline($child_node); + \Drupal::service('book.manager')->updateOutline($child_node); } } menu_link_delete($node->book['mlid']); @@ -611,10 +611,10 @@ function book_node_predelete(EntityInterface $node) { */ function book_node_prepare_form(NodeInterface $node, $form_display, $operation, array &$form_state) { // Get BookManager service - $book_manager = Drupal::service('book.manager'); + $book_manager = \Drupal::service('book.manager'); // Prepare defaults for the add/edit form. - $account = Drupal::currentUser(); + $account = \Drupal::currentUser(); if (empty($node->book) && ($account->hasPermission('add content to books') || $account->hasPermission('administer book outlines'))) { $node->book = array(); @@ -809,7 +809,7 @@ function template_preprocess_book_node_export_html(&$variables) { * A Boolean TRUE if the node type can be included in books; otherwise, FALSE. */ function book_type_is_allowed($type) { - return in_array($type, Drupal::config('book.settings')->get('allowed_types')); + return in_array($type, \Drupal::config('book.settings')->get('allowed_types')); } /** @@ -820,7 +820,7 @@ function book_type_is_allowed($type) { */ function book_node_type_update(NodeTypeInterface $type) { if ($type->getOriginalID() != $type->id()) { - $config = Drupal::config('book.settings'); + $config = \Drupal::config('book.settings'); // Update the list of node types that are allowed to be added to books. $allowed_types = $config->get('allowed_types'); $old_key = array_search($type->getOriginalID(), $allowed_types); @@ -937,7 +937,7 @@ function book_menu_subtree_data($link) { function book_library_info() { $libraries['drupal.book'] = array( 'title' => 'Book', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'book') . '/book.js' => array(), ), diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc index 40e44b2..fe4c6a0 100644 --- a/core/modules/book/book.pages.inc +++ b/core/modules/book/book.pages.inc @@ -50,7 +50,7 @@ function book_remove_form($form, &$form_state, EntityInterface $node) { */ function book_remove_form_submit($form, &$form_state) { $node = $form['#node']; - if (Drupal::service('book.manager')->checkNodeIsRemovable($node)) { + if (\Drupal::service('book.manager')->checkNodeIsRemovable($node)) { menu_link_delete($node->book['mlid']); db_delete('book') ->condition('nid', $node->id()) diff --git a/core/modules/breakpoint/breakpoint.install b/core/modules/breakpoint/breakpoint.install index 6c74779..1dc28fd 100644 --- a/core/modules/breakpoint/breakpoint.install +++ b/core/modules/breakpoint/breakpoint.install @@ -16,5 +16,5 @@ function breakpoint_enable() { _breakpoint_theme_enabled(array_keys($themes)); // Import breakpoints from modules. - _breakpoint_modules_enabled(array_keys(Drupal::moduleHandler()->getModuleList())); + _breakpoint_modules_enabled(array_keys(\Drupal::moduleHandler()->getModuleList())); } diff --git a/core/modules/breakpoint/breakpoint.module b/core/modules/breakpoint/breakpoint.module index 1a4a80c..31fa932 100644 --- a/core/modules/breakpoint/breakpoint.module +++ b/core/modules/breakpoint/breakpoint.module @@ -156,7 +156,7 @@ function _breakpoint_import_media_queries($group_name, $label, $source_type, $me * Either Breakpoint::SOURCE_TYPE_THEME or Breakpoint::SOURCE_TYPE_MODULE. */ function _breakpoint_import_breakpoint_groups($source, $source_type) { - $breakpoint_groups = Drupal::config($source . '.breakpoint_groups'); + $breakpoint_groups = \Drupal::config($source . '.breakpoint_groups'); if ($breakpoint_groups) { foreach ($breakpoint_groups->get() as $group_name => $data) { // Breakpoints is mandatory, extra check since this is coming from config. @@ -188,7 +188,7 @@ function _breakpoint_import_breakpoint_groups($source, $source_type) { */ function _breakpoint_delete_breakpoints($list, $source_type) { $ids = config_get_storage_names_with_prefix('breakpoint.breakpoint_group.' . $source_type . '.'); - $entity_info = Drupal::service('entity.manager')->getDefinition('breakpoint_group'); + $entity_info = \Drupal::service('entity.manager')->getDefinition('breakpoint_group'); // Remove the breakpoint.breakpoint part of the breakpoint identifier. foreach ($ids as &$id) { @@ -202,8 +202,8 @@ function _breakpoint_delete_breakpoints($list, $source_type) { $breakpoint_group->delete(); // Get all breakpoints defined by this theme/module. - $breakpoint_ids = Drupal::service('config.storage')->listAll('breakpoint.breakpoint.' . $source_type . '.' . $breakpoint_group->id() . '.'); - $entity_info = Drupal::service('entity.manager')->getDefinition('breakpoint'); + $breakpoint_ids = \Drupal::service('config.storage')->listAll('breakpoint.breakpoint.' . $source_type . '.' . $breakpoint_group->id() . '.'); + $entity_info = \Drupal::service('entity.manager')->getDefinition('breakpoint'); // Remove the breakpoint.breakpoint part of the breakpoint identifier. foreach ($breakpoint_ids as &$breakpoint_id) { @@ -260,7 +260,7 @@ function breakpoint_get_theme_media_queries($theme_key) { throw new \Exception('Illegal theme_key passed.'); } - $config = Drupal::config($theme_key . '.breakpoints'); + $config = \Drupal::config($theme_key . '.breakpoints'); if ($config) { return $config->get(); } @@ -277,11 +277,11 @@ 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 (!Drupal::moduleHandler()->moduleExists($module)) { + if (!\Drupal::moduleHandler()->moduleExists($module)) { throw new \Exception('Illegal module name passed.'); } - $config = Drupal::config($module . '.breakpoints'); + $config = \Drupal::config($module . '.breakpoints'); if ($config) { return $config->get(); } diff --git a/core/modules/ckeditor/ckeditor.module b/core/modules/ckeditor/ckeditor.module index 10f8bab..aceb3a8 100644 --- a/core/modules/ckeditor/ckeditor.module +++ b/core/modules/ckeditor/ckeditor.module @@ -44,7 +44,7 @@ function ckeditor_library_info() { ); $libraries['drupal.ckeditor'] = array( 'title' => 'Drupal behavior to enable CKEditor on textareas.', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $module_path . '/js/ckeditor.js' => array(), array('data' => $settings, 'type' => 'setting'), @@ -60,7 +60,7 @@ function ckeditor_library_info() { ); $libraries['drupal.ckeditor.admin'] = array( 'title' => 'Drupal behavior for drag-and-drop CKEditor toolbar builder UI.', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $module_path . '/js/ckeditor.admin.js' => array(), ), @@ -83,7 +83,7 @@ function ckeditor_library_info() { ); $libraries['drupal.ckeditor.drupalimage.admin'] = array( 'title' => 'Only show the "drupalimage" plugin settings when its button is enabled.', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $module_path . '/js/ckeditor.drupalimage.admin.js' => array(), ), @@ -97,7 +97,7 @@ function ckeditor_library_info() { ); $libraries['drupal.ckeditor.stylescombo.admin'] = array( 'title' => 'Only show the "stylescombo" plugin settings when its button is enabled.', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $module_path . '/js/ckeditor.stylescombo.admin.js' => array(), ), @@ -111,7 +111,7 @@ function ckeditor_library_info() { ); $libraries['drupal.ckeditor.drupalimagecaption-theme'] = array( 'title' => 'Theming support for the imagecaption plugin.', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $module_path . '/js/plugins/drupalimagecaption/theme.js' => array(), ), @@ -176,7 +176,7 @@ function ckeditor_ckeditor_css_alter(array &$css, Editor $editor) { function _ckeditor_theme_css($theme = NULL) { $css = array(); if (!isset($theme)) { - $theme = Drupal::config('system.theme')->get('default'); + $theme = \Drupal::config('system.theme')->get('default'); } if ($theme_path = drupal_get_path('theme', $theme)) { $info = system_get_info('theme', $theme); diff --git a/core/modules/color/color.install b/core/modules/color/color.install index f896938..923f38f 100644 --- a/core/modules/color/color.install +++ b/core/modules/color/color.install @@ -52,7 +52,7 @@ function color_update_8001() { // Get theme name from color palette variable. preg_match('/color_(.*)_palette/', $theme_palette, $matches); $theme_key = $matches[1]; - $config = Drupal::config('color.' . $theme_key); + $config = \Drupal::config('color.' . $theme_key); $config->set('palette', update_variable_get('color_' . $theme_key . '_palette')); $config->set('logo', update_variable_get('color_' . $theme_key . '_logo')); $config->set('stylesheets', update_variable_get('color_' . $theme_key . '_stylesheets')); diff --git a/core/modules/color/color.module b/core/modules/color/color.module index fefb51a..8cc6223 100644 --- a/core/modules/color/color.module +++ b/core/modules/color/color.module @@ -64,7 +64,7 @@ function color_css_alter(&$css) { $themes = list_themes(); // Override stylesheets. - $color_paths = Drupal::config('color.' . $theme_key)->get('stylesheets'); + $color_paths = \Drupal::config('color.' . $theme_key)->get('stylesheets'); if (!empty($color_paths) && !empty($themes[$theme_key]->stylesheets['all'])) { @@ -93,7 +93,7 @@ function color_preprocess_page(&$variables) { global $theme_key; // Override logo. - $logo = Drupal::config('color.' . $theme_key)->get('logo'); + $logo = \Drupal::config('color.' . $theme_key)->get('logo'); if ($logo && $variables['logo'] && preg_match('!' . $theme_key . '/logo.png$!', $variables['logo'])) { $variables['logo'] = file_create_url($logo); } @@ -132,7 +132,7 @@ function color_get_palette($theme, $default = FALSE) { // Load variable. // @todo Default color config should be moved to yaml in the theme. - return Drupal::config('color.' . $theme)->get('palette') ?: $palette; + return \Drupal::config('color.' . $theme)->get('palette') ?: $palette; } /** @@ -160,7 +160,7 @@ function color_scheme_form($complete_form, &$form_state, $theme) { // See if we're using a predefined scheme. // Note: we use the original theme when the default scheme is chosen. - $current_scheme = Drupal::config('color.' . $theme)->get('palette'); + $current_scheme = \Drupal::config('color.' . $theme)->get('palette'); foreach ($schemes as $key => $scheme) { if ($current_scheme == $scheme) { $scheme_name = $key; @@ -282,7 +282,7 @@ function color_scheme_form_submit($form, &$form_state) { $theme = $form_state['values']['theme']; $info = $form_state['values']['info']; - $config = Drupal::config('color.' . $theme); + $config = \Drupal::config('color.' . $theme); // Resolve palette. $palette = $form_state['values']['palette']; @@ -540,7 +540,7 @@ function _color_render_images($theme, &$info, &$paths, $palette) { if ($file == 'screenshot.png') { $slice = imagecreatetruecolor(150, 90); imagecopyresampled($slice, $target, 0, 0, $x, $y, 150, 90, $width, $height); - Drupal::config('color.' . $theme) + \Drupal::config('color.' . $theme) ->set('screenshot', $image) ->save(); } @@ -736,7 +736,7 @@ function _color_rgb2hsl($rgb) { function color_library_info() { $libraries['drupal.color'] = array( 'title' => 'Color', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'color') . '/color.js' => array(), ), @@ -750,7 +750,7 @@ function color_library_info() { ); $libraries['drupal.color.preview'] = array( 'title' => 'Color preview', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'color') . '/preview.js' => array(), ), diff --git a/core/modules/comment/comment.admin.inc b/core/modules/comment/comment.admin.inc index 741ad5c..f732a57 100644 --- a/core/modules/comment/comment.admin.inc +++ b/core/modules/comment/comment.admin.inc @@ -18,11 +18,11 @@ * @see comment_multiple_delete_confirm() */ function comment_admin($type = 'new') { - $request = Drupal::request(); + $request = \Drupal::request(); $edit = $request->request->all(); if (isset($edit['operation']) && ($edit['operation'] == 'delete') && isset($edit['comments']) && $edit['comments']) { - return drupal_get_form(ConfirmDeleteMultiple::create(Drupal::getContainer()), $request); + return drupal_get_form(ConfirmDeleteMultiple::create(\Drupal::getContainer()), $request); } else { return drupal_get_form('comment_admin_overview', $type); diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index 04e1291..f71a7e4 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -12,7 +12,7 @@ function comment_uninstall() { // Remove variables. variable_del('comment_block_count'); $node_types = array_keys(node_type_get_types()); - Drupal::entityManager()->addNamespaces(new ArrayIterator(array( + \Drupal::entityManager()->addNamespaces(new ArrayIterator(array( 'Drupal\comment' => DRUPAL_ROOT . '/core/modules/comment/lib', ))); drupal_classloader_register('comment', 'core/modules/comment'); @@ -30,7 +30,7 @@ function comment_uninstall() { } // Remove states. - Drupal::state()->delete('comment.node_comment_statistics_scale'); + \Drupal::state()->delete('comment.node_comment_statistics_scale'); } /** diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 808ac54..b33c920 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -525,7 +525,7 @@ function comment_node_view(EntityInterface $node, EntityDisplay $display, $view_ 'fragment' => 'comments', 'html' => TRUE, ); - if (Drupal::moduleHandler()->moduleExists('history')) { + if (\Drupal::moduleHandler()->moduleExists('history')) { $links['comment-new-comments'] = array( 'title' => '', 'href' => '', @@ -604,7 +604,7 @@ function comment_node_view(EntityInterface $node, EntityDisplay $display, $view_ '#links' => $links, '#attributes' => array('class' => array('links', 'inline')), ); - if ($view_mode == 'teaser' && Drupal::moduleHandler()->moduleExists('history')) { + if ($view_mode == 'teaser' && \Drupal::moduleHandler()->moduleExists('history')) { $node->content['links']['#attached']['library'][] = array('comment', 'drupal.node-new-comments-link'); } @@ -622,7 +622,7 @@ function comment_node_view(EntityInterface $node, EntityDisplay $display, $view_ * Implements hook_node_view_alter(). */ function comment_node_view_alter(&$build, EntityInterface $node, EntityDisplay $display) { - if (Drupal::moduleHandler()->moduleExists('history')) { + if (\Drupal::moduleHandler()->moduleExists('history')) { $build['#attributes']['data-history-node-id'] = $node->id(); } } @@ -687,7 +687,7 @@ function comment_node_page_additions(EntityInterface $node) { function comment_add(EntityInterface $node, $pid = NULL) { $values = array('nid' => $node->id(), 'pid' => $pid, 'node_type' => 'comment_node_' . $node->getType()); $comment = entity_create('comment', $values); - return Drupal::entityManager()->getForm($comment); + return \Drupal::entityManager()->getForm($comment); } /** @@ -1186,7 +1186,7 @@ function comment_node_update_index(EntityInterface $node, $langcode) { // edit could change the security situation so it is not safe to index the // comments. $index_comments = TRUE; - $roles = Drupal::entityManager()->getStorageController('user_role')->loadMultiple(); + $roles = \Drupal::entityManager()->getStorageController('user_role')->loadMultiple(); $authenticated_can_access = $roles[DRUPAL_AUTHENTICATED_RID]->hasPermission('access comments'); foreach ($roles as $rid => $role) { if ($role->hasPermission('search content') && !$role->hasPermission('access comments')) { @@ -1216,7 +1216,7 @@ function comment_node_update_index(EntityInterface $node, $langcode) { */ function comment_update_index() { // Store the maximum possible comments per thread (used for ranking by reply count) - Drupal::state()->set('comment.node_comment_statistics_scale', 1.0 / max(1, db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}')->fetchField())); + \Drupal::state()->set('comment.node_comment_statistics_scale', 1.0 / max(1, db_query('SELECT MAX(comment_count) FROM {node_comment_statistics}')->fetchField())); } /** @@ -1423,7 +1423,7 @@ function comment_preview(Comment $comment) { $comment->name->value = check_plain($account->getUsername()); } elseif (empty($comment->name->value)) { - $comment->name->value = Drupal::config('user.settings')->get('anonymous'); + $comment->name->value = \Drupal::config('user.settings')->get('anonymous'); } $comment->created->value = !empty($comment->created->value) ? $comment->created->value : REQUEST_TIME; @@ -1521,7 +1521,7 @@ function template_preprocess_comment(&$variables) { $variables['user_picture'] = array(); } - if (Drupal::config('user.settings')->get('signatures') && $account->getSignature()) { + if (\Drupal::config('user.settings')->get('signatures') && $account->getSignature()) { $variables['signature'] = check_markup($account->getSignature(), $account->getSignatureFormat(), '', TRUE) ; } else { @@ -1646,7 +1646,7 @@ function theme_comment_post_forbidden($variables) { $destination = array('destination' => 'node/' . $node->id() . '#comment-form'); } - if (Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) { + if (\Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY) { // Users can register themselves. return t('Log in or register to post comments', array('@login' => url('user/login', array('query' => $destination)), '@register' => url('user/register', array('query' => $destination)))); } @@ -1750,7 +1750,7 @@ function comment_ranking() { ), // Inverse law that maps the highest reply count on the site to 1 and 0 to 0. 'score' => '2.0 - 2.0 / (1.0 + node_comment_statistics.comment_count * CAST(:scale AS DECIMAL))', - 'arguments' => array(':scale' => Drupal::state()->get('comment.node_comment_statistics_scale') ?: 0), + 'arguments' => array(':scale' => \Drupal::state()->get('comment.node_comment_statistics_scale') ?: 0), ), ); } @@ -1775,7 +1775,7 @@ function comment_library_info() { $path = drupal_get_path('module', 'comment'); $libraries['drupal.comment'] = array( 'title' => 'Comment', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/comment-node-form.js' => array(), ), @@ -1787,7 +1787,7 @@ function comment_library_info() { ); $libraries['drupal.comment-by-viewer'] = array( 'title' => 'Annotate comments by the current viewer for targeted styling', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/js/comment-by-viewer.js' => array(), ), @@ -1799,7 +1799,7 @@ function comment_library_info() { ); $libraries['drupal.comment-new-indicator'] = array( 'title' => 'New comment indicator', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/js/comment-new-indicator.js' => array(), ), @@ -1812,7 +1812,7 @@ function comment_library_info() { ); $libraries['drupal.node-new-comments-link'] = array( 'title' => 'New comments link', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/js/node-new-comments-link.js' => array(), ), diff --git a/core/modules/comment/comment.tokens.inc b/core/modules/comment/comment.tokens.inc index 8002162..da28f1a 100644 --- a/core/modules/comment/comment.tokens.inc +++ b/core/modules/comment/comment.tokens.inc @@ -103,7 +103,7 @@ function comment_token_info() { * Implements hook_tokens(). */ function comment_tokens($type, $tokens, array $data = array(), array $options = array()) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $url_options = array('absolute' => TRUE); if (isset($options['langcode'])) { @@ -133,7 +133,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options = break; case 'name': - $name = ($comment->uid->target_id == 0) ? Drupal::config('user.settings')->get('anonymous') : $comment->name->value; + $name = ($comment->uid->target_id == 0) ? \Drupal::config('user.settings')->get('anonymous') : $comment->name->value; $replacements[$original] = $sanitize ? filter_xss($name) : $name; break; diff --git a/core/modules/comment/comment.views.inc b/core/modules/comment/comment.views.inc index d8887ff..79602d2 100644 --- a/core/modules/comment/comment.views.inc +++ b/core/modules/comment/comment.views.inc @@ -360,7 +360,7 @@ function comment_views_data() { ), ); - if (Drupal::moduleHandler()->moduleExists('content_translation')) { + if (\Drupal::moduleHandler()->moduleExists('content_translation')) { $data['comment']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for comments.'), diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module index a985921..487b70a 100644 --- a/core/modules/config/tests/config_test/config_test.module +++ b/core/modules/config/tests/config_test/config_test.module @@ -79,7 +79,7 @@ function config_test_cache_flush() { * Implements hook_ENTITY_TYPE_create(). */ function config_test_config_test_create(ConfigTest $config_test) { - if (Drupal::state()->get('config_test.prepopulate')) { + if (\Drupal::state()->get('config_test.prepopulate')) { $config_test->set('foo', 'baz'); } } @@ -91,7 +91,7 @@ function config_test_entity_info_alter(&$entity_info) { // The 'translatable' entity key is not supposed to change over time. In this // case we can safely do it because we set it once and we do not change it for // all the duration of the test session. - $entity_info['config_test']['translatable'] = Drupal::service('state')->get('config_test.translatable'); + $entity_info['config_test']['translatable'] = \Drupal::service('state')->get('config_test.translatable'); // Create a clone of config_test that does not have a status. $entity_info['config_test_no_status'] = $entity_info['config_test']; diff --git a/core/modules/contact/contact.install b/core/modules/contact/contact.install index 60b51b0..3f71a5d 100644 --- a/core/modules/contact/contact.install +++ b/core/modules/contact/contact.install @@ -12,11 +12,11 @@ * Implements hook_install(). */ function contact_install() { - $site_mail = Drupal::config('system.site')->get('mail'); + $site_mail = \Drupal::config('system.site')->get('mail'); if (empty($site_mail)) { $site_mail = ini_get('sendmail_from'); } - Drupal::config('contact.category.feedback')->set('recipients', array($site_mail))->save(); + \Drupal::config('contact.category.feedback')->set('recipients', array($site_mail))->save(); } /** @@ -61,12 +61,12 @@ function contact_update_8001() { $category->id = $category->cid; // Save default category setting. if ($category->selected) { - Drupal::config('contact.settings') + \Drupal::config('contact.settings') ->set('default_category', $category->id) ->save(); } // Save the config object. - Drupal::config('contact.category.' . $category->id) + \Drupal::config('contact.category.' . $category->id) ->set('id', $category->id) ->set('uuid', $uuid->generate()) ->set('label', $category->category) diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 2b1d8bf..58884bf 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -148,13 +148,13 @@ function _contact_personal_tab_access(UserInterface $account) { // If the requested user has disabled their contact form, do not allow users // to contact them. - $account_data = Drupal::service('user.data')->get('contact', $account->id(), 'enabled'); + $account_data = \Drupal::service('user.data')->get('contact', $account->id(), 'enabled'); if (isset($account_data) && empty($account_data)) { return FALSE; } // If the requested user did not save a preference yet, deny access if the // configured default is disabled. - elseif (!Drupal::config('contact.settings')->get('user_default_enabled')) { + elseif (!\Drupal::config('contact.settings')->get('user_default_enabled')) { return FALSE; } @@ -167,7 +167,7 @@ function _contact_personal_tab_access(UserInterface $account) { function contact_entity_bundle_info() { $bundles = array(); foreach (config_get_storage_names_with_prefix('contact.category.') as $config_name) { - $config = Drupal::config($config_name); + $config = \Drupal::config($config_name); $bundles['contact_message'][$config->get('id')]['label'] = $config->get('label'); } return $bundles; @@ -264,7 +264,7 @@ function contact_mail($key, &$message, $params) { $language = language_load($message['langcode']); $variables = array( - '!site-name' => Drupal::config('system.site')->get('name'), + '!site-name' => \Drupal::config('system.site')->get('name'), '!subject' => $contact_message->getSubject(), '!category' => !empty($params['contact_category']) ? $params['contact_category']->label() : NULL, '!form-url' => url(current_path(), array('absolute' => TRUE, 'language' => $language)), @@ -324,11 +324,11 @@ function contact_form_user_form_alter(&$form, &$form_state) { '#weight' => 5, ); $account = $form_state['controller']->getEntity(); - $account_data = !user_is_anonymous() ? Drupal::service('user.data')->get('contact', $account->id(), 'enabled') : NULL; + $account_data = !user_is_anonymous() ? \Drupal::service('user.data')->get('contact', $account->id(), 'enabled') : NULL; $form['contact']['contact'] = array( '#type' => 'checkbox', '#title' => t('Personal contact form'), - '#default_value' => isset($account_data) ? $account_data : Drupal::config('contact.settings')->get('user_default_enabled'), + '#default_value' => isset($account_data) ? $account_data : \Drupal::config('contact.settings')->get('user_default_enabled'), '#description' => t('Allow other users to contact you via a personal contact form which keeps your e-mail address hidden. Note that some privileged users such as site administrators are still able to contact you even if you choose to disable this feature.'), ); $form['actions']['submit']['#submit'][] = 'contact_user_profile_form_submit'; @@ -340,7 +340,7 @@ function contact_form_user_form_alter(&$form, &$form_state) { function contact_user_profile_form_submit($form, &$form_state) { $account = $form_state['controller']->getEntity(); if ($account->id() && isset($form_state['values']['contact'])) { - Drupal::service('user.data')->set('contact', $account->id(), 'enabled', (int) $form_state['values']['contact']); + \Drupal::service('user.data')->set('contact', $account->id(), 'enabled', (int) $form_state['values']['contact']); } } @@ -361,7 +361,7 @@ function contact_form_user_admin_settings_alter(&$form, &$form_state) { '#type' => 'checkbox', '#title' => t('Enable the personal contact form by default for new users.'), '#description' => t('Changing this setting will not affect existing users.'), - '#default_value' => Drupal::config('contact.settings')->get('user_default_enabled'), + '#default_value' => \Drupal::config('contact.settings')->get('user_default_enabled'), ); // Add submit handler to save contact configuration. $form['#submit'][] = 'contact_form_user_admin_settings_submit'; @@ -373,7 +373,7 @@ function contact_form_user_admin_settings_alter(&$form, &$form_state) { * @see contact_form_user_admin_settings_alter() */ function contact_form_user_admin_settings_submit($form, &$form_state) { - Drupal::config('contact.settings') + \Drupal::config('contact.settings') ->set('user_default_enabled', $form_state['values']['contact_default_status']) ->save(); } diff --git a/core/modules/contact/contact.pages.inc b/core/modules/contact/contact.pages.inc index b6da2ec..5a8cea3 100644 --- a/core/modules/contact/contact.pages.inc +++ b/core/modules/contact/contact.pages.inc @@ -30,7 +30,7 @@ function contact_site_page(Category $category = NULL) { if (!isset($category)) { $categories = entity_load_multiple('contact_category'); - $default_category = Drupal::config('contact.settings')->get('default_category'); + $default_category = \Drupal::config('contact.settings')->get('default_category'); if (isset($categories[$default_category])) { $category = $categories[$default_category]; } @@ -51,7 +51,7 @@ function contact_site_page(Category $category = NULL) { $message = entity_create('contact_message', array( 'category' => $category->id(), )); - return Drupal::entityManager()->getForm($message); + return \Drupal::entityManager()->getForm($message); } /** @@ -81,7 +81,7 @@ function contact_personal_page($recipient) { 'recipient' => $recipient, 'category' => 'personal', )); - return Drupal::entityManager()->getForm($message); + return \Drupal::entityManager()->getForm($message); } /** @@ -93,10 +93,10 @@ function contact_personal_page($recipient) { * @see contact_personal_page() */ function contact_flood_control() { - $config = Drupal::config('contact.settings'); + $config = \Drupal::config('contact.settings'); $limit = $config->get('flood.limit'); $interval = $config->get('flood.interval'); - if (!Drupal::service('flood')->isAllowed('contact', $limit, $interval)) { + if (!\Drupal::service('flood')->isAllowed('contact', $limit, $interval)) { drupal_set_message(t("You cannot send more than %limit messages in @interval. Try again later.", array( '%limit' => $limit, '@interval' => format_interval($interval), diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc index da4558a..9904ba0 100644 --- a/core/modules/content_translation/content_translation.admin.inc +++ b/core/modules/content_translation/content_translation.admin.inc @@ -424,7 +424,7 @@ function content_translation_translatable_batch($translatable, $field_name, &$co $query_field = "$field_name.$column"; // How many entities will need processing? - $query = Drupal::entityQuery($entity_type); + $query = \Drupal::entityQuery($entity_type); $count = $query ->exists($query_field) ->count() @@ -449,7 +449,7 @@ function content_translation_translatable_batch($translatable, $field_name, &$co $info = entity_get_info($entity_type); $offset = $context['sandbox']['progress_entity_type'][$entity_type]; - $query = Drupal::entityQuery($entity_type); + $query = \Drupal::entityQuery($entity_type); $field = field_info_field($entity_type, $field_name); $column = isset($field['columns']['value']) ? 'value' : key($field['columns']); $query_field = "$field_name.$column"; diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module index 3ced188..7c10214 100644 --- a/core/modules/content_translation/content_translation.module +++ b/core/modules/content_translation/content_translation.module @@ -356,7 +356,7 @@ function content_translation_library_info() { $path = drupal_get_path('module', 'content_translation'); $libraries['drupal.content_translation.admin'] = array( 'title' => 'Content translation UI', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/content_translation.admin.js' => array(), ), @@ -413,7 +413,7 @@ function content_translation_get_config_key($entity_type, $bundle, $setting) { */ function content_translation_get_config($entity_type, $bundle, $setting) { $key = content_translation_get_config_key($entity_type, $bundle, $setting); - return Drupal::config('content_translation.settings')->get($key); + return \Drupal::config('content_translation.settings')->get($key); } /** @@ -430,7 +430,7 @@ function content_translation_get_config($entity_type, $bundle, $setting) { */ function content_translation_set_config($entity_type, $bundle, $setting, $value) { $key = content_translation_get_config_key($entity_type, $bundle, $setting); - return Drupal::config('content_translation.settings')->set($key, $value)->save(); + return \Drupal::config('content_translation.settings')->set($key, $value)->save(); } /** @@ -871,8 +871,8 @@ function content_translation_entity_presave(EntityInterface $entity) { if ($entity->isTranslatable()) { // @todo Avoid using request attributes once translation metadata become // regular fields. - $attributes = Drupal::request()->attributes; - Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->id, $attributes->get('source_langcode')); + $attributes = \Drupal::request()->attributes; + \Drupal::service('content_translation.synchronizer')->synchronizeFields($entity, $entity->language()->id, $attributes->get('source_langcode')); } } diff --git a/core/modules/content_translation/content_translation.pages.inc b/core/modules/content_translation/content_translation.pages.inc index 966d259..f918c2b 100644 --- a/core/modules/content_translation/content_translation.pages.inc +++ b/core/modules/content_translation/content_translation.pages.inc @@ -17,7 +17,7 @@ */ function content_translation_overview(EntityInterface $entity) { $controller = content_translation_controller($entity->entityType()); - $entity_manager = Drupal::entityManager(); + $entity_manager = \Drupal::entityManager(); $languages = language_list(); $original = $entity->getUntranslated()->language()->id; $translations = $entity->getTranslationLanguages(); @@ -201,7 +201,7 @@ function content_translation_add_page(EntityInterface $entity, Language $source $form_state['content_translation']['target'] = $target; $controller = content_translation_controller($entity->entityType()); $form_state['content_translation']['translation_form'] = !$entity->access('update'); - return Drupal::entityManager()->getForm($entity, $operation, $form_state); + return \Drupal::entityManager()->getForm($entity, $operation, $form_state); } /** @@ -222,7 +222,7 @@ function content_translation_edit_page(EntityInterface $entity, Language $langua $operation = isset($info['default_operation']) ? $info['default_operation'] : 'default'; $form_state['langcode'] = $language->id; $form_state['content_translation']['translation_form'] = TRUE; - return Drupal::entityManager()->getForm($entity, $operation, $form_state); + return \Drupal::entityManager()->getForm($entity, $operation, $form_state); } /** @@ -287,7 +287,7 @@ function content_translation_delete_confirm_submit(array $form, array &$form_sta // @todo This should be taken care of by the Path module. if (module_exists('path')) { $conditions = array('source' => $controller->getViewPath($entity), 'langcode' => $language->id); - Drupal::service('path.crud')->delete($conditions); + \Drupal::service('path.crud')->delete($conditions); } $form_state['redirect'] = $controller->getBasePath($entity) . '/translations'; diff --git a/core/modules/contextual/contextual.module b/core/modules/contextual/contextual.module index 527cc2b..be9c67c 100644 --- a/core/modules/contextual/contextual.module +++ b/core/modules/contextual/contextual.module @@ -25,7 +25,7 @@ function contextual_menu() { */ function contextual_toolbar() { - if (!Drupal::currentUser()->hasPermission('access contextual links')) { + if (!\Drupal::currentUser()->hasPermission('access contextual links')) { return; } @@ -64,7 +64,7 @@ function contextual_toolbar() { */ function contextual_page_build(&$page) { - if (!Drupal::currentUser()->hasPermission('access contextual links')) { + if (!\Drupal::currentUser()->hasPermission('access contextual links')) { return; } @@ -109,7 +109,7 @@ function contextual_library_info() { $libraries['drupal.contextual-links'] = array( 'title' => 'Contextual Links', 'website' => 'http://drupal.org/node/473268', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( // Add the JavaScript, with a group and weight such that it will run // before modules/contextual/js/contextual.toolbar.js. @@ -131,7 +131,7 @@ function contextual_library_info() { ); $libraries['drupal.contextual-toolbar'] = array( 'title' => 'Contextual Links Toolbar Tab', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( // Add the JavaScript, with a group and weight such that it will run // before modules/overlay/overlay-parent.js. diff --git a/core/modules/dblog/dblog.module b/core/modules/dblog/dblog.module index 165d3cb..315bc0d 100644 --- a/core/modules/dblog/dblog.module +++ b/core/modules/dblog/dblog.module @@ -97,7 +97,7 @@ function dblog_page_build(&$page) { */ function dblog_cron() { // Cleanup the watchdog table. - $row_limit = Drupal::config('dblog.settings')->get('row_limit'); + $row_limit = \Drupal::config('dblog.settings')->get('row_limit'); // For row limit n, get the wid of the nth row in descending wid order. // Counting the most recent n rows avoids issues with wid number sequences, @@ -167,7 +167,7 @@ function dblog_form_system_logging_settings_alter(&$form, $form_state) { $form['dblog_row_limit'] = array( '#type' => 'select', '#title' => t('Database log messages to keep'), - '#default_value' => Drupal::config('dblog.settings')->get('row_limit'), + '#default_value' => \Drupal::config('dblog.settings')->get('row_limit'), '#options' => array(0 => t('All')) + drupal_map_assoc(array(100, 1000, 10000, 100000, 1000000)), '#description' => t('The maximum number of messages to keep in the database log. Requires a cron maintenance task.', array('@cron' => url('admin/reports/status'))) ); @@ -181,5 +181,5 @@ function dblog_form_system_logging_settings_alter(&$form, $form_state) { * @see dblog_form_system_logging_settings_alter() */ function dblog_logging_settings_submit($form, &$form_state) { - Drupal::config('dblog.settings')->set('row_limit', $form_state['values']['dblog_row_limit'])->save(); + \Drupal::config('dblog.settings')->set('row_limit', $form_state['values']['dblog_row_limit'])->save(); } diff --git a/core/modules/edit/edit.module b/core/modules/edit/edit.module index ae02deb..e465e00 100644 --- a/core/modules/edit/edit.module +++ b/core/modules/edit/edit.module @@ -55,7 +55,7 @@ function edit_permission() { * editing' permission. */ function edit_page_build(&$page) { - if (!Drupal::currentUser()->hasPermission('access in-place editing')) { + if (!\Drupal::currentUser()->hasPermission('access in-place editing')) { return; } @@ -79,7 +79,7 @@ function edit_library_info() { ); $libraries['edit'] = array( 'title' => 'Edit: in-place editing', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( // Core. $path . '/js/edit.js' => $options, @@ -121,7 +121,7 @@ function edit_library_info() { ); $libraries['edit.editorWidget.form'] = array( 'title' => 'Form in-place editor', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/js/editors/formEditor.js' => $options, ), @@ -131,7 +131,7 @@ function edit_library_info() { ); $libraries['edit.editorWidget.direct'] = array( 'title' => 'Direct in-place editor', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/js/editors/directEditor.js' => $options, ), diff --git a/core/modules/editor/editor.module b/core/modules/editor/editor.module index 75632ca..7eae8cc 100644 --- a/core/modules/editor/editor.module +++ b/core/modules/editor/editor.module @@ -71,7 +71,7 @@ function editor_library_info() { $libraries['drupal.editor.admin'] = array( 'title' => 'Text Editor', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/js/editor.admin.js' => array(), ), @@ -82,7 +82,7 @@ function editor_library_info() { ); $libraries['drupal.editor'] = array( 'title' => 'Text Editor', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/js/editor.js' => array(), ), @@ -99,7 +99,7 @@ function editor_library_info() { $libraries['drupal.editor.dialog'] = array( 'title' => 'Text Editor Dialog', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/js/editor.dialog.js' => array('weight' => 2), ), @@ -113,7 +113,7 @@ function editor_library_info() { $libraries['edit.formattedTextEditor.editor'] = array( 'title' => 'Formatted text editor', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/js/editor.formattedTextEditor.js' => array( 'scope' => 'footer', @@ -165,7 +165,7 @@ function editor_form_filter_admin_overview_alter(&$form, $form_state) { $form['formats']['#header'] = array_merge($start, $form['formats']['#header']); // Then splice in the name of each text editor for each text format. - $editors = Drupal::service('plugin.manager.editor')->getDefinitions(); + $editors = \Drupal::service('plugin.manager.editor')->getDefinitions(); foreach (element_children($form['formats']) as $format_id) { $editor = editor_load($format_id); $editor_name = ($editor && isset($editors[$editor->editor])) ? $editors[$editor->editor]['label'] : drupal_placeholder('—'); @@ -183,7 +183,7 @@ function editor_form_filter_format_form_alter(&$form, &$form_state) { if (!isset($form_state['editor'])) { $format_id = $form_state['controller']->getEntity()->id(); $form_state['editor'] = editor_load($format_id); - $form_state['editor_manager'] = Drupal::service('plugin.manager.editor'); + $form_state['editor_manager'] = \Drupal::service('plugin.manager.editor'); } $editor = $form_state['editor']; $manager = $form_state['editor_manager']; @@ -383,7 +383,7 @@ function editor_pre_render_format($element) { $element['#attached']['library'][] = array('editor', 'drupal.editor'); // Attach attachments for all available editors. - $manager = Drupal::service('plugin.manager.editor'); + $manager = \Drupal::service('plugin.manager.editor'); $element['#attached'] = NestedArray::mergeDeep($element['#attached'], $manager->getAttachments($format_ids)); return $element; diff --git a/core/modules/editor/tests/modules/editor_test.module b/core/modules/editor/tests/modules/editor_test.module index cdaf52e..fc2d748 100644 --- a/core/modules/editor/tests/modules/editor_test.module +++ b/core/modules/editor/tests/modules/editor_test.module @@ -31,7 +31,7 @@ function editor_test_editor_default_settings_alter(&$settings, $editor) { */ function editor_test_editor_js_settings_alter(&$settings) { // Allow tests to enable or disable this alter hook. - if (!Drupal::state()->get('editor_test_js_settings_alter_enabled', FALSE)) { + if (!\Drupal::state()->get('editor_test_js_settings_alter_enabled', FALSE)) { return; } diff --git a/core/modules/email/email.module b/core/modules/email/email.module index 6ee5916..5a5f116 100644 --- a/core/modules/email/email.module +++ b/core/modules/email/email.module @@ -31,7 +31,7 @@ function email_help($path, $arg) { * Implements hook_field_info_alter(). */ function email_field_info_alter(&$info) { - if (Drupal::moduleHandler()->moduleExists('text')) { + if (\Drupal::moduleHandler()->moduleExists('text')) { $info['email']['default_formatter'] = 'text_plain'; } } diff --git a/core/modules/entity/entity.install b/core/modules/entity/entity.install index 9cbd71e..95d485b 100644 --- a/core/modules/entity/entity.install +++ b/core/modules/entity/entity.install @@ -25,7 +25,7 @@ */ function _update_8000_entity_get_display($entity_type, $bundle, $view_mode) { $id = $entity_type . '.' . $bundle . '.' . $view_mode; - $config = Drupal::config("entity.display.$id"); + $config = \Drupal::config("entity.display.$id"); if ($config->get()) { return $config; } @@ -64,7 +64,7 @@ function _update_8000_entity_get_display($entity_type, $bundle, $view_mode) { */ function _update_8000_entity_get_form_display($entity_type, $bundle, $form_mode) { $id = $entity_type . '.' . $bundle . '.' . $form_mode; - $config = Drupal::config("entity.form_display.$id"); + $config = \Drupal::config("entity.form_display.$id"); if ($config->get()) { return $config; } diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module index 10364d8..b9e7c58 100644 --- a/core/modules/entity_reference/entity_reference.module +++ b/core/modules/entity_reference/entity_reference.module @@ -15,7 +15,7 @@ * Implements hook_field_info_alter(). */ function entity_reference_field_info_alter(&$info) { - if (!Drupal::moduleHandler()->moduleExists('node')) { + if (!\Drupal::moduleHandler()->moduleExists('node')) { // Fall back to another primary entity type if the Node module is not // available. $info['entity_reference']['settings']['target_type'] = 'user'; @@ -171,7 +171,7 @@ function entity_reference_settings_ajax_submit($form, &$form_state) { * Implements hook_options_list(). */ function entity_reference_options_list(FieldDefinitionInterface $field_definition, EntityInterface $entity) { - if (!$options = Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($field_definition, $entity)->getReferenceableEntities()) { + if (!$options = \Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($field_definition, $entity)->getReferenceableEntities()) { return array(); } diff --git a/core/modules/field/field.deprecated.inc b/core/modules/field/field.deprecated.inc index 8ac601e..fad6339 100644 --- a/core/modules/field/field.deprecated.inc +++ b/core/modules/field/field.deprecated.inc @@ -24,16 +24,16 @@ * keyed by field type name. * * @deprecated as of Drupal 8.0. Use - * Drupal::service('plugin.manager.entity.field.field_type')->getDefinition() + * \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition() * or - * Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions() + * \Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions() */ function field_info_field_types($field_type = NULL) { if ($field_type) { - return Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field_type); + return \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field_type); } else { - return Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions(); + return \Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions(); } } @@ -48,7 +48,7 @@ function field_info_field_types($field_type = NULL) { * are not defined. * * @deprecated as of Drupal 8.0. Use - * Drupal::service('plugin.manager.entity.field.field_type')->getDefaultSettings() + * \Drupal::service('plugin.manager.entity.field.field_type')->getDefaultSettings() */ function field_info_field_settings($type) { return \Drupal::service('plugin.manager.entity.field.field_type')->getDefaultSettings($type); @@ -65,7 +65,7 @@ function field_info_field_settings($type) { * settings are not defined. * * @deprecated as of Drupal 8.0. Use - * Drupal::service('plugin.manager.entity.field.field_type')->getDefaultInstanceSettings() + * \Drupal::service('plugin.manager.entity.field.field_type')->getDefaultInstanceSettings() */ function field_info_instance_settings($type) { return \Drupal::service('plugin.manager.entity.field.field_type')->getDefaultInstanceSettings($type); @@ -83,9 +83,9 @@ function field_info_instance_settings($type) { * or an array of all existing widget types, keyed by widget type name. * * @deprecated as of Drupal 8.0. Use - * Drupal::service('plugin.manager.field.widget')->getDefinition() + * \Drupal::service('plugin.manager.field.widget')->getDefinition() * or - * Drupal::service('plugin.manager.field.widget')->getDefinitions() + * \Drupal::service('plugin.manager.field.widget')->getDefinitions() */ function field_info_widget_types($widget_type = NULL) { if ($widget_type) { @@ -108,7 +108,7 @@ function field_info_widget_types($widget_type = NULL) { * undefined. * * @deprecated as of Drupal 8.0. Use - * Drupal::service('plugin.manager.field.widget')->getDefaultSettings() + * \Drupal::service('plugin.manager.field.widget')->getDefaultSettings() */ function field_info_widget_settings($type) { return \Drupal::service('plugin.manager.field.widget')->getDefaultSettings($type); @@ -127,9 +127,9 @@ function field_info_widget_settings($type) { * formatter type name. * * @deprecated as of Drupal 8.0. Use - * Drupal::service('plugin.manager.field.formatter')->getDefinition() + * \Drupal::service('plugin.manager.field.formatter')->getDefinition() * or - * Drupal::service('plugin.manager.field.formatter')->getDefinitions() + * \Drupal::service('plugin.manager.field.formatter')->getDefinitions() */ function field_info_formatter_types($formatter_type = NULL) { if ($formatter_type) { @@ -152,7 +152,7 @@ function field_info_formatter_types($formatter_type = NULL) { * undefined. * * @deprecated as of Drupal 8.0. Use - * Drupal::service('plugin.manager.field.formatter')->getDefaultSettings() + * \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings() */ function field_info_formatter_settings($type) { return \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($type); @@ -577,7 +577,7 @@ function field_attach_form(EntityInterface $entity, &$form, &$form_state, $langc // Let other modules make changes to the form. // Avoid \Drupal::moduleHandler()->invokeAll() // to let parameters be taken by reference. - foreach (Drupal::moduleHandler()->getImplementations('field_attach_form') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('field_attach_form') as $module) { $function = $module . '_field_attach_form'; $function($entity, $form, $form_state, $langcode); } @@ -673,7 +673,7 @@ function field_attach_extract_form_values(EntityInterface $entity, $form, &$form // Let other modules act on submitting the entity. // Avoid \Drupal::moduleHandler()->invokeAll() // to let $form_state be taken by reference. - foreach (Drupal::moduleHandler()->getImplementations('field_attach_extract_form_values') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('field_attach_extract_form_values') as $module) { $function = $module . 'field_attach_extract_form_values'; $function($entity, $form, $form_state); } diff --git a/core/modules/field/field.info.inc b/core/modules/field/field.info.inc index 9bb495c..79345a8 100644 --- a/core/modules/field/field.info.inc +++ b/core/modules/field/field.info.inc @@ -38,8 +38,8 @@ function field_info_cache_clear() { entity_info_cache_clear(); // Clear typed data definitions. - Drupal::typedData()->clearCachedDefinitions(); - Drupal::service('plugin.manager.entity.field.field_type')->clearCachedDefinitions(); + \Drupal::typedData()->clearCachedDefinitions(); + \Drupal::service('plugin.manager.entity.field.field_type')->clearCachedDefinitions(); Field::fieldInfo()->flush(); } diff --git a/core/modules/field/field.install b/core/modules/field/field.install index feed708..cf7dd11 100644 --- a/core/modules/field/field.install +++ b/core/modules/field/field.install @@ -43,7 +43,7 @@ function _update_8003_field_create_field(array &$field_config) { ); // Save in config. - Drupal::config('field.field.' . $field_config['id']) + \Drupal::config('field.field.' . $field_config['id']) ->setData($field_config) ->save(); @@ -88,7 +88,7 @@ function _update_8003_field_create_instance(array $field_config, array &$instanc ); // Save in config. - Drupal::config('field.instance.' . $instance_config['id']) + \Drupal::config('field.instance.' . $instance_config['id']) ->setData($instance_config) ->save(); } @@ -116,7 +116,7 @@ function _update_8006_field_write_data_sql($entity_type, $bundle, $entity_id, $r $revision_id = $entity_id; } - $field_config = Drupal::config("field.field.$entity_type.$field_name"); + $field_config = \Drupal::config("field.field.$entity_type.$field_name"); $field = new Field($field_config); $table_name = DatabaseStorageController::_fieldTableName($field); @@ -313,7 +313,7 @@ function field_update_8002() { function field_update_8003() { $uuid = new Uuid(); - $state = Drupal::state(); + $state = \Drupal::state(); $deleted_fields = $state->get('field.field.deleted') ?: array(); $deleted_instances = $state->get('field.instance.deleted') ?: array(); @@ -348,7 +348,7 @@ function field_update_8003() { // Save in either config or state. if (!$record['deleted']) { - Drupal::config('field.field.' . $config['id']) + \Drupal::config('field.field.' . $config['id']) ->setData($config) ->save(); } @@ -403,7 +403,7 @@ function field_update_8003() { // Save in either config or state. if (!$record['deleted']) { - Drupal::config('field.instance.' . $config['id']) + \Drupal::config('field.instance.' . $config['id']) ->setData($config) ->save(); } @@ -448,7 +448,7 @@ function field_update_8004() { function field_update_8005() { $uuid = new Uuid(); - $user_default_form_display = Drupal::config('entity.form_display.user.user.default'); + $user_default_form_display = \Drupal::config('entity.form_display.user.user.default'); $user_register_config_data = array( 'id' => 'user.user.register', 'uuid' => $uuid->generate(), @@ -458,7 +458,7 @@ function field_update_8005() { 'content' => array(), ); foreach (config_get_storage_names_with_prefix('field.instance') as $config_id) { - $instance_config = Drupal::config($config_id); + $instance_config = \Drupal::config($config_id); if ($instance_config->get('entity_type') == 'user' && $instance_config->get('settings.user_register_form')) { list(, , $field_id) = explode('.', $instance_config->get('id')); $user_register_config_data['content'][$field_id] = $user_default_form_display->get('content.' . $field_id); @@ -469,7 +469,7 @@ function field_update_8005() { } // Save the new 'register' form display. - Drupal::config('entity.form_display.user.user.register') + \Drupal::config('entity.form_display.user.user.register') ->setData($user_register_config_data) ->save(); } @@ -481,7 +481,7 @@ function field_update_8005() { function field_update_8006(&$sandbox) { // Get field definitions from config, and deleted fields from state system. $config_names = config_get_storage_names_with_prefix('field.field'); - $deleted_fields = Drupal::state()->get('field.field.deleted') ?: array(); + $deleted_fields = \Drupal::state()->get('field.field.deleted') ?: array(); // Ditch UUID keys, we will iterate through deleted fields using a numeric // index. $deleted_fields = array_values($deleted_fields); @@ -498,7 +498,7 @@ function field_update_8006(&$sandbox) { // Retrieve the next field definition. When the index exceeds the number of // 'configuration' fields, use it to iterate on deleted fields. if (isset($config_names[$sandbox['index']])) { - $field_config = Drupal::config($config_names[$sandbox['index']])->get(); + $field_config = \Drupal::config($config_names[$sandbox['index']])->get(); } else { $field_config = $deleted_fields[$sandbox['index'] - count($config_names)]; diff --git a/core/modules/field/field.module b/core/modules/field/field.module index cc7ad90..e5ef622 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -125,12 +125,12 @@ function field_help($path, $arg) { // order by displayed module name (module names are not translated). $items = array(); $info = system_get_info('module'); - $modules = array_merge(Drupal::moduleHandler()->getImplementations('field_info'), Drupal::moduleHandler()->getImplementations('field_widget_info')); + $modules = array_merge(\Drupal::moduleHandler()->getImplementations('field_info'), \Drupal::moduleHandler()->getImplementations('field_widget_info')); $modules = array_unique($modules); sort($modules); foreach ($modules as $module) { $display = $info[$module]['name']; - if (Drupal::moduleHandler()->implementsHook($module, 'help')) { + if (\Drupal::moduleHandler()->implementsHook($module, 'help')) { $items['items'][] = l($display, 'admin/help/' . $module); } else { @@ -168,7 +168,7 @@ function field_cron() { field_sync_field_status(); // Do a pass of purging on deleted Field API data, if any exists. - $limit = Drupal::config('field.settings')->get('purge_batch_size'); + $limit = \Drupal::config('field.settings')->get('purge_batch_size'); field_purge_batch($limit); } @@ -356,13 +356,13 @@ function field_modules_disabled($modules) { * Refreshes the 'active' and 'storage[active]' values for fields. */ function field_sync_field_status() { - $module_handler = Drupal::moduleHandler(); - $state = Drupal::state(); + $module_handler = \Drupal::moduleHandler(); + $state = \Drupal::state(); // Get both deleted and non-deleted field definitions. $fields = array(); foreach (config_get_storage_names_with_prefix('field.field.') as $name) { - $field = Drupal::config($name)->get(); + $field = \Drupal::config($name)->get(); $fields[$field['uuid']] = $field; } $deleted_fields = $state->get('field.field.deleted') ?: array(); @@ -376,7 +376,7 @@ function field_sync_field_status() { // modules. $changed = array(); $modules = $module_handler->getModuleList(); - $field_types = Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions(); + $field_types = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions(); // Set fields with missing field type modules to inactive. foreach ($fields as $uuid => &$field) { // Associate field types. @@ -397,7 +397,7 @@ function field_sync_field_status() { $deleted_fields[$uuid] = $field; } else { - Drupal::config('field.field.' . $field['id']) + \Drupal::config('field.field.' . $field['id']) ->set('module', $field['module']) ->set('active', $field['active']) ->save(); @@ -749,7 +749,7 @@ function field_access($op, FieldInterface $field, $entity_type, $entity = NULL, $account = $user; } - foreach (Drupal::moduleHandler()->getImplementations('field_access') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('field_access') as $module) { $function = $module . '_field_access'; $access = $function($op, $field, $entity_type, $entity, $account); if ($access === FALSE) { diff --git a/core/modules/field/field.multilingual.inc b/core/modules/field/field.multilingual.inc index d02595c..ce14a25 100644 --- a/core/modules/field/field.multilingual.inc +++ b/core/modules/field/field.multilingual.inc @@ -198,7 +198,7 @@ function field_content_languages() { * Checks whether field language fallback is enabled. */ function field_language_fallback_enabled() { - return language_multilingual() && Drupal::config('field.settings')->get('language_fallback'); + return language_multilingual() && \Drupal::config('field.settings')->get('language_fallback'); } /** diff --git a/core/modules/field/field.purge.inc b/core/modules/field/field.purge.inc index 5ab55ef..df30467 100644 --- a/core/modules/field/field.purge.inc +++ b/core/modules/field/field.purge.inc @@ -73,7 +73,7 @@ function field_purge_batch($batch_size) { // Retrieve all deleted field instances. We cannot use field_info_instances() // because that function does not return deleted instances. $instances = field_read_instances(array('deleted' => TRUE), array('include_deleted' => TRUE)); - $factory = Drupal::service('entity.query'); + $factory = \Drupal::service('entity.query'); $info = entity_get_info(); foreach ($instances as $instance) { $entity_type = $instance['entity_type']; @@ -111,7 +111,7 @@ function field_purge_batch($batch_size) { $ids->revision_id = $revision_id; $ids->entity_id = $entity_id; $entity = _field_create_entity_from_ids($ids); - Drupal::entityManager()->getStorageController($entity_type)->onFieldItemsPurge($entity, $instance); + \Drupal::entityManager()->getStorageController($entity_type)->onFieldItemsPurge($entity, $instance); } } else { @@ -121,7 +121,7 @@ function field_purge_batch($batch_size) { } // Retrieve all deleted fields. Any that have no instances can be purged. - $deleted_fields = Drupal::state()->get('field.field.deleted') ?: array(); + $deleted_fields = \Drupal::state()->get('field.field.deleted') ?: array(); foreach ($deleted_fields as $field) { $field = new Field($field); @@ -149,7 +149,7 @@ function field_purge_batch($batch_size) { * The instance record to purge. */ function field_purge_instance($instance) { - $state = Drupal::state(); + $state = \Drupal::state(); $deleted_instances = $state->get('field.instance.deleted'); unset($deleted_instances[$instance['uuid']]); $state->set('field.instance.deleted', $deleted_instances); @@ -158,7 +158,7 @@ function field_purge_instance($instance) { field_info_cache_clear(); // Invoke external hooks after the cache is cleared for API consistency. - Drupal::moduleHandler()->invokeAll('field_purge_instance', array($instance)); + \Drupal::moduleHandler()->invokeAll('field_purge_instance', array($instance)); } /** @@ -176,19 +176,19 @@ function field_purge_field($field) { throw new FieldException(t('Attempt to purge a field @field_name that still has instances.', array('@field_name' => $field['field_name']))); } - $state = Drupal::state(); + $state = \Drupal::state(); $deleted_fields = $state->get('field.field.deleted'); unset($deleted_fields[$field['uuid']]); $state->set('field.field.deleted', $deleted_fields); // Notify the storage layer. - Drupal::entityManager()->getStorageController($field->entity_type)->onFieldPurge($field); + \Drupal::entityManager()->getStorageController($field->entity_type)->onFieldPurge($field); // Clear the cache. field_info_cache_clear(); // Invoke external hooks after the cache is cleared for API consistency. - Drupal::moduleHandler()->invokeAll('field_purge_field', array($field)); + \Drupal::moduleHandler()->invokeAll('field_purge_field', array($field)); } /** diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc index d6d9e97..8269575 100644 --- a/core/modules/field/field.views.inc +++ b/core/modules/field/field.views.inc @@ -20,7 +20,7 @@ */ function field_views_data() { $data = array(); - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); foreach (field_info_fields() as $field) { if (_field_views_is_sql_entity_type($field)) { @@ -68,7 +68,7 @@ function field_views_data_alter(&$data) { * True if the entity type uses DatabaseStorageController. */ function _field_views_is_sql_entity_type(FieldInterface $field) { - $entity_manager = Drupal::entityManager(); + $entity_manager = \Drupal::entityManager(); try { if ($entity_manager->getStorageController($field->entity_type) instanceof DatabaseStorageController) { return TRUE; @@ -129,7 +129,7 @@ function field_views_field_default_views_data(FieldInterface $field) { $field_name = $field['field_name']; // Grab information about the entity type tables. - $entity_manager = Drupal::entityManager(); + $entity_manager = \Drupal::entityManager(); $entity_type = $field->entity_type; $entity_info = $entity_manager->getDefinition($entity_type); if (!isset($entity_info['base_table'])) { diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/LegacyFieldTypeDiscoveryDecorator.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/LegacyFieldTypeDiscoveryDecorator.php index 2936b47..2fc45a4 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/LegacyFieldTypeDiscoveryDecorator.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/LegacyFieldTypeDiscoveryDecorator.php @@ -57,7 +57,7 @@ public function getDefinitions() { $definitions = $this->decorated->getDefinitions(); // We cannot use HookDiscovery, since it uses - // Drupal::moduleHandler()->getImplementations(), which + // \Drupal::moduleHandler()->getImplementations(), which // throws exceptions during upgrades. foreach (array_keys($this->moduleHandler->getModuleList()) as $module) { $function = $module . '_field_info'; diff --git a/core/modules/field/tests/modules/field_test/field_test.entity.inc b/core/modules/field/tests/modules/field_test/field_test.entity.inc index 8f140e3..3d4b0fa 100644 --- a/core/modules/field/tests/modules/field_test/field_test.entity.inc +++ b/core/modules/field/tests/modules/field_test/field_test.entity.inc @@ -14,7 +14,7 @@ function field_test_entity_info() { // If requested, clear the field cache while this is being called. See // Drupal\field\Tests\FieldInfoTest::testFieldInfoCache(). - if (Drupal::state()->get('field_test.clear_info_cache_in_hook_entity_info')) { + if (\Drupal::state()->get('field_test.clear_info_cache_in_hook_entity_info')) { field_info_cache_clear(); } } diff --git a/core/modules/field/tests/modules/field_test/field_test.module b/core/modules/field/tests/modules/field_test/field_test.module index 3ab0c7e..42c019f 100644 --- a/core/modules/field/tests/modules/field_test/field_test.module +++ b/core/modules/field/tests/modules/field_test/field_test.module @@ -56,7 +56,7 @@ function field_test_menu() { * Implements hook_field_available_languages_alter(). */ function field_test_field_available_languages_alter(&$langcodes, $context) { - if (Drupal::state()->get('field_test.field_available_languages_alter')) { + if (\Drupal::state()->get('field_test.field_available_languages_alter')) { // Add an unavailable language code. $langcodes[] = 'xx'; // Remove an available language code. @@ -69,7 +69,7 @@ function field_test_field_available_languages_alter(&$langcodes, $context) { * Implements hook_field_language_alter(). */ function field_test_field_language_alter(&$display_langcode, $context) { - if (Drupal::state()->get('field_test.language_fallback') ?: TRUE) { + if (\Drupal::state()->get('field_test.language_fallback') ?: TRUE) { field_language_fallback($display_langcode, $context['entity'], $context['langcode']); } } diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index 18a631e..55c74a3 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -264,7 +264,7 @@ function field_ui_entity_info(&$entity_info) { function field_ui_entity_bundle_create($entity_type, $bundle) { // When a new bundle is created, the menu needs to be rebuilt to add our // menu item tabs. - Drupal::state()->set('menu_rebuild_needed', TRUE); + \Drupal::state()->set('menu_rebuild_needed', TRUE); } /** @@ -273,7 +273,7 @@ function field_ui_entity_bundle_create($entity_type, $bundle) { function field_ui_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { // When a bundle is renamed, the menu needs to be rebuilt to add our // menu item tabs. - Drupal::state()->set('menu_rebuild_needed', TRUE); + \Drupal::state()->set('menu_rebuild_needed', TRUE); } /** @@ -338,7 +338,7 @@ function field_ui_entity_operation_alter(array &$operations, EntityInterface $en */ function field_ui_form_node_type_form_submit($form, &$form_state) { if ($form_state['triggering_element']['#parents'][0] === 'save_continue') { - $admin_path = Drupal::entityManager()->getAdminPath('node', $form_state['values']['type']); + $admin_path = \Drupal::entityManager()->getAdminPath('node', $form_state['values']['type']); $form_state['redirect'] = "$admin_path/fields"; } } @@ -349,7 +349,7 @@ function field_ui_form_node_type_form_submit($form, &$form_state) { function field_ui_library_info() { $libraries['drupal.field_ui'] = array( 'title' => 'Field UI', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'field_ui') . '/field_ui.js' => array(), ), @@ -371,14 +371,14 @@ function field_ui_library_info() { * Implements hook_view_mode_presave(). */ function field_ui_view_mode_presave(EntityViewModeInterface $view_mode) { - Drupal::state()->set('menu_rebuild_needed', TRUE); + \Drupal::state()->set('menu_rebuild_needed', TRUE); } /** * Implements hook_view_mode_delete(). */ function field_ui_view_mode_delete(EntityViewModeInterface $view_mode) { - Drupal::state()->set('menu_rebuild_needed', TRUE); + \Drupal::state()->set('menu_rebuild_needed', TRUE); } /** diff --git a/core/modules/file/file.field.inc b/core/modules/file/file.field.inc index d3a583b..430f79f 100644 --- a/core/modules/file/file.field.inc +++ b/core/modules/file/file.field.inc @@ -116,7 +116,7 @@ function file_field_widget_process($element, &$form_state, $form) { // Add the description field if enabled. if ($element['#description_field'] && $item['fids']) { - $config = Drupal::config('file.settings'); + $config = \Drupal::config('file.settings'); $element['description'] = array( '#type' => $config->get('description.type'), '#title' => t('Description'), diff --git a/core/modules/file/file.install b/core/modules/file/file.install index 33717c2..7fb5772 100644 --- a/core/modules/file/file.install +++ b/core/modules/file/file.install @@ -163,7 +163,7 @@ function file_requirements($phase) { // Check the server's ability to indicate upload progress. if ($phase == 'runtime') { $implementation = file_progress_implementation(); - $server_software = Drupal::request()->server->get('SERVER_SOFTWARE'); + $server_software = \Drupal::request()->server->get('SERVER_SOFTWARE'); $apache = strpos($server_software, 'Apache') !== FALSE; $fastcgi = strpos($server_software, 'mod_fastcgi') !== FALSE || strpos($server_software, 'mod_fcgi') !== FALSE; $description = NULL; @@ -266,7 +266,7 @@ function file_update_8002() { */ function file_update_8003() { foreach (config_get_storage_names_with_prefix('field.field.') as $config_name) { - $field_config = Drupal::config($config_name); + $field_config = \Drupal::config($config_name); // Only update file fields that use the default SQL storage. if (in_array($field_config->get('type'), array('file', 'image'))) { $field = new Field($field_config->get()); diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 345c6ec..a0e60e0 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -123,7 +123,7 @@ function file_load($fid, $reset = FALSE) { * @return Drupal\file\FileUsage\FileUsageInterface. */ function file_usage() { - return Drupal::service('file.usage'); + return \Drupal::service('file.usage'); } /** @@ -195,7 +195,7 @@ function file_copy(File $source, $destination = NULL, $replace = FILE_EXISTS_REN $file->save(); // Inform modules that the file has been copied. - Drupal::moduleHandler()->invokeAll('file_copy', array($file, $source)); + \Drupal::moduleHandler()->invokeAll('file_copy', array($file, $source)); return $file; } @@ -270,7 +270,7 @@ function file_move(File $source, $destination = NULL, $replace = FILE_EXISTS_REN $file->save(); // Inform modules that the file has been moved. - Drupal::moduleHandler()->invokeAll('file_move', array($file, $source)); + \Drupal::moduleHandler()->invokeAll('file_move', array($file, $source)); // Delete the original if it's not in use elsewhere. if ($delete_source && !file_usage()->listUsage($source)) { @@ -314,7 +314,7 @@ function file_validate(File $file, $validators = array()) { } // Let other modules perform validation on the new file. - return array_merge($errors, Drupal::moduleHandler()->invokeAll('file_validate', array($file))); + return array_merge($errors, \Drupal::moduleHandler()->invokeAll('file_validate', array($file))); } /** @@ -381,7 +381,7 @@ function file_validate_extensions(File $file, $extensions) { * @see hook_file_validate() */ function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) { - $user = Drupal::currentUser(); + $user = \Drupal::currentUser(); $errors = array(); if ($file_limit && $file->getSize() > $file_limit) { @@ -389,7 +389,7 @@ function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) { } // Save a query by only calling spaceUsed() when a limit is provided. - if ($user_limit && (Drupal::entityManager()->getStorageController('file')->spaceUsed($user->id()) + $file->getSize()) > $user_limit) { + if ($user_limit && (\Drupal::entityManager()->getStorageController('file')->spaceUsed($user->id()) + $file->getSize()) > $user_limit) { $errors[] = t('The file is %filesize which would exceed your disk quota of %quota.', array('%filesize' => format_size($file->getSize()), '%quota' => format_size($user_limit))); } @@ -410,7 +410,7 @@ function file_validate_size(File $file, $file_limit = 0, $user_limit = 0) { function file_validate_is_image(File $file) { $errors = array(); - $image = Drupal::service('image.factory')->get($file->getFileUri()); + $image = \Drupal::service('image.factory')->get($file->getFileUri()); if (!$image->getExtension()) { $errors[] = t('Only JPEG, PNG and GIF images are allowed.'); } @@ -445,7 +445,7 @@ function file_validate_image_resolution(File $file, $maximum_dimensions = 0, $mi $errors = array(); // Check first that the file is an image. - $image_factory = Drupal::service('image.factory'); + $image_factory = \Drupal::service('image.factory'); $image = $image_factory->get($file->getFileUri()); if ($image->getExtension()) { if ($maximum_dimensions) { @@ -502,7 +502,7 @@ function file_validate_image_resolution(File $file, $maximum_dimensions = 0, $mi * @see file_unmanaged_save_data() */ function file_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAME) { - $user = Drupal::currentUser(); + $user = \Drupal::currentUser(); if (empty($destination)) { $destination = file_default_scheme() . '://'; @@ -600,7 +600,7 @@ function file_theme() { * be re-used by other File-like modules, such as Image. */ function file_file_download($uri, $field_type = 'file') { - $user = Drupal::currentUser(); + $user = \Drupal::currentUser(); // Get the file record based on the URI. If not in the database just return. $files = entity_load_multiple_by_properties('file', array('uri' => $uri)); @@ -651,7 +651,7 @@ function file_file_download($uri, $field_type = 'file') { // Invoke hook and collect grants/denies for download access. // Default to FALSE and let entities overrule this ruling. $grants = array('system' => FALSE); - foreach (Drupal::moduleHandler()->getImplementations('file_download_access') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('file_download_access') as $module) { $grants = array_merge($grants, array($module => module_invoke($module, 'file_download_access', $field, $entity, $file))); } // Allow other modules to alter the returned grants/denies. @@ -693,7 +693,7 @@ function file_file_download($uri, $field_type = 'file') { * Implements file_cron() */ function file_cron() { - $result = Drupal::entityManager()->getStorageController('file')->retrieveTemporaryFiles(); + $result = \Drupal::entityManager()->getStorageController('file')->retrieveTemporaryFiles(); foreach ($result as $row) { if ($file = file_load($row->fid)) { $references = file_usage()->listUsage($file); @@ -758,7 +758,7 @@ function file_cron() { * - destination: Path to the file after it is moved (same as 'uri'). */ function file_save_upload($form_field_name, $validators = array(), $destination = FALSE, $delta = NULL, $replace = FILE_EXISTS_RENAME) { - $user = Drupal::currentUser(); + $user = \Drupal::currentUser(); static $upload_cache; // Make sure there's an upload to process. @@ -857,7 +857,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination // rename filename.php.foo and filename.php to filename.php.foo.txt and // filename.php.txt, respectively). Don't rename if 'allow_insecure_uploads' // evaluates to TRUE. - if (!Drupal::config('system.file')->get('allow_insecure_uploads') && preg_match('/\.(php|pl|py|cgi|asp|js)(\.|$)/i', $file->getFilename()) && (substr($file->getFilename(), -4) != '.txt')) { + if (!\Drupal::config('system.file')->get('allow_insecure_uploads') && preg_match('/\.(php|pl|py|cgi|asp|js)(\.|$)/i', $file->getFilename()) && (substr($file->getFilename(), -4) != '.txt')) { $file->setMimeType('text/plain'); $file->setFileUri($file->getFileUri() . '.txt'); $file->setFilename($file->getFilename() . '.txt'); @@ -989,7 +989,7 @@ function file_file_predelete(File $file) { * Implements hook_tokens(). */ function file_tokens($type, $tokens, array $data = array(), array $options = array()) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $url_options = array('absolute' => TRUE); if (isset($options['langcode'])) { @@ -1646,7 +1646,7 @@ function file_icon_url(File $file, $icon_directory = NULL) { function file_icon_path(File $file, $icon_directory = NULL) { // Use the default set of icons if none specified. if (!isset($icon_directory)) { - $icon_directory = Drupal::config('file.settings')->get('icon.directory'); + $icon_directory = \Drupal::config('file.settings')->get('icon.directory'); } // If there's an icon matching the exact mimetype, go for it. @@ -1922,7 +1922,7 @@ function file_get_file_references(File $file, $field = NULL, $age = EntityStorag function file_library_info() { $libraries['drupal.file'] = array( 'title' => 'File', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'file') . '/file.js' => array(), ), diff --git a/core/modules/file/tests/file_test/file_test.module b/core/modules/file/tests/file_test/file_test.module index 90fc900..e5a10a0 100644 --- a/core/modules/file/tests/file_test/file_test.module +++ b/core/modules/file/tests/file_test/file_test.module @@ -54,14 +54,14 @@ function file_test_reset() { 'move' => array(), 'delete' => array(), ); - Drupal::state()->set('file_test.results', $results); + \Drupal::state()->set('file_test.results', $results); // These hooks will return these values, see file_test_set_return(). $return = array( 'validate' => array(), 'download' => NULL, ); - Drupal::state()->set('file_test.return', $return); + \Drupal::state()->set('file_test.return', $return); } /** @@ -79,7 +79,7 @@ function file_test_reset() { * @see file_test_reset() */ function file_test_get_calls($op) { - $results = Drupal::state()->get('file_test.results') ?: array(); + $results = \Drupal::state()->get('file_test.results') ?: array(); return $results[$op]; } @@ -92,7 +92,7 @@ function file_test_get_calls($op) { * passed to each call. */ function file_test_get_all_calls() { - return Drupal::state()->get('file_test.results') ?: array(); + return \Drupal::state()->get('file_test.results') ?: array(); } /** @@ -108,9 +108,9 @@ function file_test_get_all_calls() { * @see file_test_reset() */ function _file_test_log_call($op, $args) { - $results = Drupal::state()->get('file_test.results') ?: array(); + $results = \Drupal::state()->get('file_test.results') ?: array(); $results[$op][] = $args; - Drupal::state()->set('file_test.results', $results); + \Drupal::state()->set('file_test.results', $results); } /** @@ -126,7 +126,7 @@ function _file_test_log_call($op, $args) { * @see file_test_reset() */ function _file_test_get_return($op) { - $return = Drupal::state()->get('file_test.return') ?: array($op => NULL); + $return = \Drupal::state()->get('file_test.return') ?: array($op => NULL); return $return[$op]; } @@ -142,9 +142,9 @@ function _file_test_get_return($op) { * @see file_test_reset() */ function file_test_set_return($op, $value) { - $return = Drupal::state()->get('file_test.return') ?: array(); + $return = \Drupal::state()->get('file_test.return') ?: array(); $return[$op] = $value; - Drupal::state()->set('file_test.return', $return); + \Drupal::state()->set('file_test.return', $return); } /** @@ -216,7 +216,7 @@ function file_test_file_predelete(File $file) { function file_test_file_url_alter(&$uri) { // Only run this hook when this variable is set. Otherwise, we'd have to add // another hidden test module just for this hook. - $alter_mode = Drupal::state()->get('file_test.hook_file_url_alter'); + $alter_mode = \Drupal::state()->get('file_test.hook_file_url_alter'); if (!$alter_mode) { return; } diff --git a/core/modules/filter/filter.install b/core/modules/filter/filter.install index 718daee..0390d79 100644 --- a/core/modules/filter/filter.install +++ b/core/modules/filter/filter.install @@ -49,7 +49,7 @@ function filter_update_8001() { $format['filters'] = $filters; // Save the config object. - $config = Drupal::config('filter.format.' . $id); + $config = \Drupal::config('filter.format.' . $id); $config->setData($format); $config->save(); } diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 732acf4..bd48535 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -201,14 +201,14 @@ function filter_formats(AccountInterface $account = NULL) { // All available formats are cached for performance. if (!isset($formats['all'])) { - $language_interface = Drupal::languageManager()->getLanguage(Language::TYPE_INTERFACE); - if ($cache = Drupal::cache()->get("filter_formats:{$language_interface->id}")) { + $language_interface = \Drupal::languageManager()->getLanguage(Language::TYPE_INTERFACE); + if ($cache = \Drupal::cache()->get("filter_formats:{$language_interface->id}")) { $formats['all'] = $cache->data; } else { - $formats['all'] = Drupal::entityManager()->getStorageController('filter_format')->loadByProperties(array('status' => '1')); + $formats['all'] = \Drupal::entityManager()->getStorageController('filter_format')->loadByProperties(array('status' => '1')); uasort($formats['all'], 'Drupal\Core\Config\Entity\ConfigEntityBase::sort'); - Drupal::cache()->set("filter_formats:{$language_interface->id}", $formats['all'], CacheBackendInterface::CACHE_PERMANENT, array('filter_formats' => TRUE)); + \Drupal::cache()->set("filter_formats:{$language_interface->id}", $formats['all'], CacheBackendInterface::CACHE_PERMANENT, array('filter_formats' => TRUE)); } } @@ -528,7 +528,7 @@ function filter_fallback_format() { // existing (and potentially unsafe) text format on the site automatically // available to all users. Returning NULL at least guarantees that this // cannot happen. - return Drupal::config('filter.settings')->get('fallback_format'); + return \Drupal::config('filter.settings')->get('fallback_format'); } /** @@ -737,7 +737,7 @@ function filter_process_format($element) { // If multiple text formats are available, remove the fallback. The // "always_show_fallback_choice" is a hidden variable that has no UI. It // defaults to false. - if (!Drupal::config('filter.settings')->get('always_show_fallback_choice')) { + if (!\Drupal::config('filter.settings')->get('always_show_fallback_choice')) { $fallback_format = filter_fallback_format(); if ($element['#format'] !== $fallback_format && count($formats) > 1) { unset($formats[$fallback_format]); @@ -1079,7 +1079,7 @@ function _filter_url($text, $filter) { // we cannot cleanly differ between protocols here without hard-coding MAILTO, // so '//' is optional for all protocols. // @see filter_xss_bad_protocol() - $protocols = Drupal::config('system.filter')->get('protocols'); + $protocols = \Drupal::config('system.filter')->get('protocols'); $protocols = implode(':(?://)?|', $protocols) . ':(?://)?'; $valid_url_path_characters = "[\p{L}\p{M}\p{N}!\*\';:=\+,\.\$\/%#\[\]\-_~@&]"; @@ -1384,7 +1384,7 @@ function _filter_html_image_secure_process($text) { $src = $image->getAttribute('src'); // Remove absolute URLs pointing to the local domain to prevent mixed // content errors. - $request = Drupal::request(); + $request = \Drupal::request(); $image->setAttribute('src', preg_replace('|^https?://' . $request->getHost() . '|', '', $src)); // Verify that $src starts with $base_path. @@ -1456,7 +1456,7 @@ function filter_library_info() { $libraries['drupal.filter.admin'] = array( 'title' => 'Filter', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/filter.admin.js' => array(), ), @@ -1472,7 +1472,7 @@ function filter_library_info() { ); $libraries['drupal.filter.filter_html.admin'] = array( 'title' => 'Automatic "Limit allowed HTML tags" filter setting updating.', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/filter.filter_html.admin.js' => array(), ), @@ -1484,7 +1484,7 @@ function filter_library_info() { ); $libraries['drupal.filter'] = array( 'title' => 'Filter', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/filter.js' => array(), ), @@ -1499,7 +1499,7 @@ function filter_library_info() { ); $libraries['caption'] = array( 'title' => 'Captions for images and alignments', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'css' => array( $path . '/css/filter.caption.css', ), diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install index e4b1e26..1b06ad7 100644 --- a/core/modules/forum/forum.install +++ b/core/modules/forum/forum.install @@ -14,9 +14,9 @@ function forum_install() { // Set the weight of the forum.module to 1 so it is loaded after the taxonomy.module. module_set_weight('forum', 1); // Do not allow to delete the forum's node type machine name. - $locked = Drupal::state()->get('node.type.locked'); + $locked = \Drupal::state()->get('node.type.locked'); $locked['forum'] = 'forum'; - Drupal::state()->set('node.type.locked', $locked); + \Drupal::state()->set('node.type.locked', $locked); } /** @@ -26,7 +26,7 @@ function forum_enable() { // Create the forum vocabulary if it does not exist. // @todo Change Forum module so forum.settings can contain the vocabulary's // machine name. - $config = Drupal::config('forum.settings'); + $config = \Drupal::config('forum.settings'); // If the module was disabled only, the current config may contain a valid // vocabulary ID already. $vocabulary = entity_load('taxonomy_vocabulary', $config->get('vocabulary')); @@ -115,7 +115,7 @@ function forum_enable() { * Implements hook_modules_preinstall(). */ function forum_modules_preinstall($modules) { - $list_boolean = Drupal::service('plugin.manager.entity.field.field_type')->getDefinition('list_boolean'); + $list_boolean = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition('list_boolean'); if (empty($list_boolean) && in_array('forum', $modules)) { // Make sure that the list_boolean field type is available before our // default config is installed. @@ -145,9 +145,9 @@ function forum_uninstall() { field_purge_batch(10); field_purge_batch(10); // Allow to delete a forum's node type. - $locked = Drupal::state()->get('node.type.locked'); + $locked = \Drupal::state()->get('node.type.locked'); unset($locked['forum']); - Drupal::state()->set('node.type.locked', $locked); + \Drupal::state()->set('node.type.locked', $locked); } /** diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index 49fdd35..8c3b3d7 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -151,9 +151,9 @@ function forum_menu_local_tasks(&$data, $router_item, $root_path) { // Add action link to 'node/add/forum' on 'forum' sub-pages. if ($root_path == 'forum' || $root_path == 'forum/%') { - $request = Drupal::request(); + $request = \Drupal::request(); $forum_term = $request->attributes->get('taxonomy_term'); - $vid = Drupal::config('forum.settings')->get('vocabulary'); + $vid = \Drupal::config('forum.settings')->get('vocabulary'); $links = array(); // Loop through all bundles for forum taxonomy vocabulary field. $field = Field::fieldInfo()->getField('node', 'taxonomy_forums'); @@ -215,7 +215,7 @@ function forum_entity_info(&$info) { */ function forum_entity_bundle_info_alter(&$bundles) { // Take over URI construction for taxonomy terms that are forums. - if ($vid = Drupal::config('forum.settings')->get('vocabulary')) { + if ($vid = \Drupal::config('forum.settings')->get('vocabulary')) { if (isset($bundles['taxonomy_term'][$vid])) { $bundles['taxonomy_term'][$vid]['uri_callback'] = 'forum_uri'; } @@ -238,7 +238,7 @@ function forum_uri($forum) { * forum taxonomy. */ function forum_node_validate(EntityInterface $node, $form) { - if (Drupal::service('forum_manager')->checkNodeType($node)) { + if (\Drupal::service('forum_manager')->checkNodeType($node)) { // vocabulary is selected, not a "container" term. if (!$node->taxonomy_forums->isEmpty()) { // Extract the node's proper topic ID. @@ -272,7 +272,7 @@ function forum_node_validate(EntityInterface $node, $form) { * Assigns the forum taxonomy when adding a topic from within a forum. */ function forum_node_presave(EntityInterface $node) { - if (Drupal::service('forum_manager')->checkNodeType($node)) { + if (\Drupal::service('forum_manager')->checkNodeType($node)) { // Make sure all fields are set properly: $node->icon = !empty($node->icon) ? $node->icon : ''; if (!$node->taxonomy_forums->isEmpty()) { @@ -293,7 +293,7 @@ function forum_node_presave(EntityInterface $node) { * Implements hook_node_update(). */ function forum_node_update(EntityInterface $node) { - if (Drupal::service('forum_manager')->checkNodeType($node)) { + if (\Drupal::service('forum_manager')->checkNodeType($node)) { // If this is not a new revision and does exist, update the forum record, // otherwise insert a new one. if ($node->getRevisionId() == $node->original->getRevisionId() && db_query('SELECT tid FROM {forum} WHERE nid=:nid', array(':nid' => $node->id()))->fetchField()) { @@ -358,7 +358,7 @@ function forum_node_update(EntityInterface $node) { $query->execute(); // The logic for determining last_comment_count is fairly complex, so // update the index too. - Drupal::service('forum_manager')->updateIndex($node->id()); + \Drupal::service('forum_manager')->updateIndex($node->id()); } // When a forum node is unpublished, remove it from the forum_index table. else { @@ -371,7 +371,7 @@ function forum_node_update(EntityInterface $node) { * Implements hook_node_insert(). */ function forum_node_insert(EntityInterface $node) { - if (Drupal::service('forum_manager')->checkNodeType($node)) { + if (\Drupal::service('forum_manager')->checkNodeType($node)) { if (!empty($node->forum_tid)) { $nid = db_insert('forum') ->fields(array( @@ -406,7 +406,7 @@ function forum_node_insert(EntityInterface $node) { * Implements hook_node_predelete(). */ function forum_node_predelete(EntityInterface $node) { - if (Drupal::service('forum_manager')->checkNodeType($node)) { + if (\Drupal::service('forum_manager')->checkNodeType($node)) { db_delete('forum') ->condition('nid', $node->id()) ->execute(); @@ -422,7 +422,7 @@ function forum_node_predelete(EntityInterface $node) { function forum_node_load($nodes) { $node_vids = array(); foreach ($nodes as $node) { - if (Drupal::service('forum_manager')->checkNodeType($node)) { + if (\Drupal::service('forum_manager')->checkNodeType($node)) { $node_vids[] = $node->getRevisionId(); } } @@ -457,7 +457,7 @@ function forum_permission() { * $comment->save() calls hook_comment_publish() for all published comments. */ function forum_comment_publish($comment) { - Drupal::service('forum_manager')->updateIndex($comment->nid->target_id); + \Drupal::service('forum_manager')->updateIndex($comment->nid->target_id); } /** @@ -470,7 +470,7 @@ function forum_comment_update($comment) { // $comment->save() calls hook_comment_publish() for all published comments, // so we need to handle all other values here. if (!$comment->status->value) { - Drupal::service('forum_manager')->updateIndex($comment->nid->target_id); + \Drupal::service('forum_manager')->updateIndex($comment->nid->target_id); } } @@ -478,21 +478,21 @@ function forum_comment_update($comment) { * Implements hook_comment_unpublish(). */ function forum_comment_unpublish($comment) { - Drupal::service('forum_manager')->updateIndex($comment->nid->target_id); + \Drupal::service('forum_manager')->updateIndex($comment->nid->target_id); } /** * Implements hook_comment_delete(). */ function forum_comment_delete($comment) { - Drupal::service('forum_manager')->updateIndex($comment->nid->target_id); + \Drupal::service('forum_manager')->updateIndex($comment->nid->target_id); } /** * Implements hook_form_BASE_FORM_ID_alter(). */ function forum_form_taxonomy_vocabulary_form_alter(&$form, &$form_state, $form_id) { - $vid = Drupal::config('forum.settings')->get('vocabulary'); + $vid = \Drupal::config('forum.settings')->get('vocabulary'); $vocabulary = $form_state['controller']->getEntity(); if ($vid == $vocabulary->id()) { $form['help_forum_vocab'] = array( @@ -514,7 +514,7 @@ function forum_form_taxonomy_vocabulary_form_alter(&$form, &$form_state, $form_i * Implements hook_form_FORM_ID_alter() for taxonomy_term_form(). */ function forum_form_taxonomy_term_form_alter(&$form, &$form_state, $form_id) { - $vid = Drupal::config('forum.settings')->get('vocabulary'); + $vid = \Drupal::config('forum.settings')->get('vocabulary'); if (isset($form['vid']['#value']) && $form['vid']['#value'] == $vid) { // Hide multiple parents select from forum terms. $form['relations']['parent']['#access'] = FALSE; @@ -683,7 +683,7 @@ function template_preprocess_forum_list(&$variables) { $variables['forums'][$id]->icon_class = 'default'; $variables['forums'][$id]->icon_title = t('No new posts'); if ($user->isAuthenticated()) { - $variables['forums'][$id]->new_topics = Drupal::service('forum_manager')->unreadTopics($forum->id(), $user->id()); + $variables['forums'][$id]->new_topics = \Drupal::service('forum_manager')->unreadTopics($forum->id(), $user->id()); if ($variables['forums'][$id]->new_topics) { $variables['forums'][$id]->new_text = format_plural($variables['forums'][$id]->new_topics, '1 new post in forum %title', '@count new posts in forum %title', array('%title' => $variables['forums'][$id]->label())); $variables['forums'][$id]->new_url = url('forum/' . $forum->id(), array('fragment' => 'new')); @@ -806,7 +806,7 @@ function template_preprocess_forum_topic_list(&$variables) { * - first_new: Indicates whether this is the first topic with new posts. */ function template_preprocess_forum_icon(&$variables) { - $variables['hot_threshold'] = Drupal::config('forum.settings')->get('topics.hot_threshold'); + $variables['hot_threshold'] = \Drupal::config('forum.settings')->get('topics.hot_threshold'); if ($variables['num_posts'] > $variables['hot_threshold']) { $icon_status_class = $variables['new_posts'] ? 'hot-new' : 'hot'; diff --git a/core/modules/history/history.module b/core/modules/history/history.module index 5b4bd6f..0b529e0 100644 --- a/core/modules/history/history.module +++ b/core/modules/history/history.module @@ -113,7 +113,7 @@ function history_user_delete($account) { function history_library_info() { $libraries['drupal.history'] = array( 'title' => 'History', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'history') . '/js/history.js' => array(), ), diff --git a/core/modules/image/image.admin.inc b/core/modules/image/image.admin.inc index f90a4c8..b8f9c96 100644 --- a/core/modules/image/image.admin.inc +++ b/core/modules/image/image.admin.inc @@ -75,13 +75,13 @@ function theme_image_style_effects($variables) { function theme_image_style_preview($variables) { $style = $variables['style']; - $sample_image = Drupal::config('image.settings')->get('preview_image'); + $sample_image = \Drupal::config('image.settings')->get('preview_image'); $sample_width = 160; $sample_height = 160; // Set up original file information. $original_path = $sample_image; - $image_factory = Drupal::service('image.factory'); + $image_factory = \Drupal::service('image.factory'); $original_image = $image_factory->get($original_path); $original_image = array( 'width' => $original_image->getWidth(), diff --git a/core/modules/image/image.field.inc b/core/modules/image/image.field.inc index 4b1118d..1111b8a 100644 --- a/core/modules/image/image.field.inc +++ b/core/modules/image/image.field.inc @@ -40,7 +40,7 @@ function image_field_widget_process($element, &$form_state, $form) { $variables['height'] = $element['#value']['height']; } else { - $image = Drupal::service('image.factory')->get($file->getFileUri()); + $image = \Drupal::service('image.factory')->get($file->getFileUri()); if ($image->getExtension()) { $variables['width'] = $image->getWidth(); $variables['height'] = $image->getHeight(); diff --git a/core/modules/image/image.install b/core/modules/image/image.install index bbeb777..ae80170 100644 --- a/core/modules/image/image.install +++ b/core/modules/image/image.install @@ -111,7 +111,7 @@ function image_update_8000() { // Convert each style into a configuration object. foreach ($styles as $name => $style) { - $config = Drupal::config('image.style.' . $name); + $config = \Drupal::config('image.style.' . $name); $config->set('name', $name); $config->set('effects', $style['effects']); $config->save(); diff --git a/core/modules/image/image.module b/core/modules/image/image.module index fa03dcd..18887c6 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -69,7 +69,7 @@ function image_help($path, $arg) { case 'admin/config/media/image-styles': return '

' . t('Image styles commonly provide thumbnail sizes by scaling and cropping images, but can also add various effects before an image is displayed. When an image is displayed with a style, a new file is created and the original image is left unchanged.') . '

'; case 'admin/config/media/image-styles/manage/%/add/%': - $effect = Drupal::service('plugin.manager.image.effect')->getDefinition($arg[7]); + $effect = \Drupal::service('plugin.manager.image.effect')->getDefinition($arg[7]); return isset($effect['description']) ? ('

' . $effect['description'] . '

') : NULL; case 'admin/config/media/image-styles/manage/%/effects/%': $effect = entity_load('image_style', $arg[5])->getEffect($arg[7])->getPluginDefinition(); @@ -248,10 +248,10 @@ function image_file_download($uri) { $original_uri = file_uri_scheme($uri) . '://' . implode('/', $args); // Check that the file exists and is an image. - $image = Drupal::service('image.factory')->get($uri); + $image = \Drupal::service('image.factory')->get($uri); if ($image->getExtension()) { // Check the permissions of the original to grant access to this image. - $headers = Drupal::moduleHandler()->invokeAll('file_download', array($original_uri)); + $headers = \Drupal::moduleHandler()->invokeAll('file_download', array($original_uri)); // Confirm there's at least one module granting access and none denying access. if (!empty($headers) && !in_array(-1, $headers)) { return array( diff --git a/core/modules/image/tests/modules/image_module_test/image_module_test.module b/core/modules/image/tests/modules/image_module_test/image_module_test.module index 7d64d2c..0242f1e 100644 --- a/core/modules/image/tests/modules/image_module_test/image_module_test.module +++ b/core/modules/image/tests/modules/image_module_test/image_module_test.module @@ -6,7 +6,7 @@ */ function image_module_test_file_download($uri) { - $default_uri = Drupal::state()->get('image.test_file_download') ?: FALSE; + $default_uri = \Drupal::state()->get('image.test_file_download') ?: FALSE; if ($default_uri == $uri) { return array('X-Image-Owned-By' => 'image_module_test'); } diff --git a/core/modules/language/language.admin.inc b/core/modules/language/language.admin.inc index 3ebaab1..562580b 100644 --- a/core/modules/language/language.admin.inc +++ b/core/modules/language/language.admin.inc @@ -37,7 +37,7 @@ function language_negotiation_configure_form() { '#language_negotiation_info' => language_negotiation_info(), ); $form['#language_types'] = array(); - $configurable = Drupal::config('system.language.types')->get('configurable'); + $configurable = \Drupal::config('system.language.types')->get('configurable'); foreach ($form['#language_types_info'] as $type => $info) { // Show locked language types only if they are configurable. if (empty($info['locked']) || in_array($type, $configurable)) { @@ -73,7 +73,7 @@ function language_negotiation_configure_form_table(&$form, $type) { ); // Only show configurability checkbox for the unlocked language types. if (empty($info['locked'])) { - $configurable = Drupal::config('system.language.types')->get('configurable'); + $configurable = \Drupal::config('system.language.types')->get('configurable'); $table_form['configurable'] = array( '#type' => 'checkbox', '#title' => t('Customize %language_name language detection to differ from User interface text language detection settings.', array('%language_name' => $info['name'])), @@ -236,7 +236,7 @@ function theme_language_negotiation_configure_form($variables) { function language_negotiation_configure_form_submit($form, &$form_state) { $configurable_types = $form['#language_types']; - $stored_values = Drupal::config('system.language.types')->get('configurable'); + $stored_values = \Drupal::config('system.language.types')->get('configurable'); $customized = array(); $method_weights_type = array(); @@ -276,7 +276,7 @@ function language_negotiation_configure_form_submit($form, &$form_state) { // made not configurable, deactivate it first. $non_configurable = array_keys(array_diff($customized, array_filter($customized))); _language_disable_language_switcher($non_configurable); - Drupal::service('plugin.manager.block')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } $form_state['redirect'] = 'admin/config/regional/language/detection'; diff --git a/core/modules/language/language.install b/core/modules/language/language.install index 42f9c37..1753bfd 100644 --- a/core/modules/language/language.install +++ b/core/modules/language/language.install @@ -29,7 +29,7 @@ function language_install() { function language_uninstall() { // Clear variables. variable_del('language_default'); - Drupal::state()->delete('language_count'); + \Drupal::state()->delete('language_count'); // Clear variables. variable_del('language_types'); @@ -62,7 +62,7 @@ function language_disable() { // Force the language_count state to be 1, so that the when checking if the // site is multilingual (for example in language_multilingual()), the result // will be FALSE, because the language module is disabled. - Drupal::state()->set('language_count', 1); + \Drupal::state()->set('language_count', 1); } /** diff --git a/core/modules/language/language.module b/core/modules/language/language.module index 83f61e9..bbbfd28 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -340,7 +340,7 @@ function language_configuration_element_submit(&$form, &$form_state) { * - language_show: if the language element should be hidden or not. */ function language_save_default_configuration($entity_type, $bundle, $values = array()) { - Drupal::config('language.settings')->set(language_get_default_configuration_settings_key($entity_type, $bundle), array('langcode' => $values['langcode'], 'language_show' => $values['language_show']))->save(); + \Drupal::config('language.settings')->set(language_get_default_configuration_settings_key($entity_type, $bundle), array('langcode' => $values['langcode'], 'language_show' => $values['language_show']))->save(); } /** @@ -357,7 +357,7 @@ function language_save_default_configuration($entity_type, $bundle, $values = ar * - language_show: if the language element is hidden or not. */ function language_get_default_configuration($entity_type, $bundle) { - $configuration = Drupal::config('language.settings')->get(language_get_default_configuration_settings_key($entity_type, $bundle)); + $configuration = \Drupal::config('language.settings')->get(language_get_default_configuration_settings_key($entity_type, $bundle)); if (is_null($configuration)) { $configuration = array(); } @@ -374,7 +374,7 @@ function language_get_default_configuration($entity_type, $bundle) { * A string representing the bundle. */ function language_clear_default_configuration($entity_type, $bundle) { - Drupal::config('language.settings')->clear(language_get_default_configuration_settings_key($entity_type, $bundle))->save(); + \Drupal::config('language.settings')->clear(language_get_default_configuration_settings_key($entity_type, $bundle))->save(); } /** @@ -474,7 +474,7 @@ function language_save($language) { $language->is_new = $language_entity->isNew(); // Let other modules modify $language before saved. - Drupal::moduleHandler()->invokeAll('language_presave', array($language)); + \Drupal::moduleHandler()->invokeAll('language_presave', array($language)); // Assign language properties to language entity. $language_entity->label = isset($language->name) ? $language->name : ''; @@ -486,11 +486,11 @@ function language_save($language) { $language_entity->save(); $t_args = array('%language' => $language->name, '%langcode' => $language->id); if ($language->is_new) { - Drupal::moduleHandler()->invokeAll('language_insert', array($language)); + \Drupal::moduleHandler()->invokeAll('language_insert', array($language)); watchdog('language', 'The %language (%langcode) language has been created.', $t_args); } else { - Drupal::moduleHandler()->invokeAll('language_update', array($language)); + \Drupal::moduleHandler()->invokeAll('language_update', array($language)); watchdog('language', 'The %language (%langcode) language has been updated.', $t_args); } @@ -531,7 +531,7 @@ function language_update_count() { $count++; } } - Drupal::state()->set('language_count', $count); + \Drupal::state()->set('language_count', $count); } /** @@ -548,7 +548,7 @@ function language_delete($langcode) { if (isset($languages[$langcode]) && !$languages[$langcode]->locked) { $language = $languages[$langcode]; - Drupal::moduleHandler()->invokeAll('language_delete', array($language)); + \Drupal::moduleHandler()->invokeAll('language_delete', array($language)); // Remove the language. entity_delete_multiple('language_entity', array($language->id)); @@ -573,7 +573,7 @@ function language_delete($langcode) { function language_library_info() { $libraries['language.admin'] = array( 'title' => 'Language detection admin', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'language') . '/language.admin.js' => array(), ), @@ -780,7 +780,7 @@ function language_preprocess_block(&$variables) { * Drupal language codes as values. */ function language_get_browser_drupal_langcode_mappings() { - $config = Drupal::config('language.mappings'); + $config = \Drupal::config('language.mappings'); if ($config->isNew()) { return array(); } @@ -795,7 +795,7 @@ function language_get_browser_drupal_langcode_mappings() { * Drupal language codes as values. */ function language_set_browser_drupal_langcode_mappings($mappings) { - $config = Drupal::config('language.mappings'); + $config = \Drupal::config('language.mappings'); $config->setData($mappings); $config->save(); } @@ -817,7 +817,7 @@ function language_update_locked_weights() { foreach (language_list(Language::STATE_LOCKED) as $language) { $max_weight++; // Update system languages weight. - Drupal::config('language.entity.' . $language->id) + \Drupal::config('language.entity.' . $language->id) ->set('weight', $max_weight) ->save(); } diff --git a/core/modules/language/language.negotiation.inc b/core/modules/language/language.negotiation.inc index dc69597..43cd607 100644 --- a/core/modules/language/language.negotiation.inc +++ b/core/modules/language/language.negotiation.inc @@ -249,7 +249,7 @@ function language_from_user_admin(array $languages, Request $request = NULL) { * A valid language code on success, FALSE otherwise. */ function language_from_session($languages) { - $param = Drupal::config('language.negotiation')->get('session.parameter'); + $param = \Drupal::config('language.negotiation')->get('session.parameter'); // Request parameter: we need to update the session parameter only if we have // an authenticated user. @@ -289,7 +289,7 @@ function language_from_url($languages, Request $request = NULL) { return $language_url; } - switch (Drupal::config('language.negotiation')->get('url.source')) { + switch (\Drupal::config('language.negotiation')->get('url.source')) { case LANGUAGE_NEGOTIATION_URL_PREFIX: $request_path = urldecode(trim($request->getPathInfo(), '/')); @@ -365,7 +365,7 @@ function language_from_url($languages, Request $request = NULL) { */ function language_url_fallback($language = NULL, $request = NULL, $language_type = Language::TYPE_INTERFACE) { $default = language_default(); - $prefix = (Drupal::config('language.negotiation')->get('url.source') == LANGUAGE_NEGOTIATION_URL_PREFIX); + $prefix = (\Drupal::config('language.negotiation')->get('url.source') == LANGUAGE_NEGOTIATION_URL_PREFIX); // If the default language is not configured to convey language information, // a missing URL language information indicates that URL language should be @@ -406,7 +406,7 @@ function language_switcher_url($type, $path) { * Return the session language switcher block. */ function language_switcher_session($type, $path) { - $param = Drupal::config('language.negotiation')->get('session.parameter'); + $param = \Drupal::config('language.negotiation')->get('session.parameter'); $language_query = isset($_SESSION[$param]) ? $_SESSION[$param] : language($type)->id; $languages = language_list(); @@ -437,7 +437,7 @@ function language_switcher_session($type, $path) { * Reads language prefixes and uses the langcode if no prefix is set. */ function language_negotiation_url_prefixes() { - return Drupal::config('language.negotiation')->get('url.prefixes'); + return \Drupal::config('language.negotiation')->get('url.prefixes'); } /** @@ -462,7 +462,7 @@ function language_negotiation_url_prefixes_update() { * Saves language prefix settings. */ function language_negotiation_url_prefixes_save(array $prefixes) { - Drupal::config('language.negotiation') + \Drupal::config('language.negotiation') ->set('url.prefixes', $prefixes) ->save(); } @@ -471,14 +471,14 @@ function language_negotiation_url_prefixes_save(array $prefixes) { * Reads language domains. */ function language_negotiation_url_domains() { - return Drupal::config('language.negotiation')->get('url.domains'); + return \Drupal::config('language.negotiation')->get('url.domains'); } /** * Saves the language domain settings. */ function language_negotiation_url_domains_save(array $domains) { - Drupal::config('language.negotiation') + \Drupal::config('language.negotiation') ->set('url.domains', $domains) ->save(); } @@ -495,7 +495,7 @@ function language_url_rewrite_session(&$path, &$options) { global $user; if (!$user->id()) { $languages = language_list(); - $query_param = check_plain(Drupal::config('language.negotiation')->get('session.parameter')); + $query_param = check_plain(\Drupal::config('language.negotiation')->get('session.parameter')); $query_value = isset($_GET[$query_param]) ? check_plain($_GET[$query_param]) : NULL; $query_rewrite = isset($languages[$query_value]) && language_negotiation_method_enabled(LANGUAGE_NEGOTIATION_SESSION); } diff --git a/core/modules/language/tests/language_test/language_test.module b/core/modules/language/tests/language_test/language_test.module index c3386cf..33c2b36 100644 --- a/core/modules/language/tests/language_test/language_test.module +++ b/core/modules/language/tests/language_test/language_test.module @@ -24,7 +24,7 @@ function language_test_page_build() { * Implements hook_language_types_info(). */ function language_test_language_types_info() { - if (Drupal::state()->get('language_test.language_types')) { + if (\Drupal::state()->get('language_test.language_types')) { return array( 'test_language_type' => array( 'name' => t('Test'), @@ -42,15 +42,15 @@ function language_test_language_types_info() { * Implements hook_language_types_info_alter(). */ function language_test_language_types_info_alter(array &$language_types) { - if (Drupal::state()->get('language_test.content_language_type')) { + if (\Drupal::state()->get('language_test.content_language_type')) { $language_types[Language::TYPE_CONTENT]['locked'] = FALSE; unset($language_types[Language::TYPE_CONTENT]['fixed']); // By default languages are not configurable. Make Language::TYPE_CONTENT // configurable. - $configurable = Drupal::config('system.language.types')->get('configurable'); + $configurable = \Drupal::config('system.language.types')->get('configurable'); if (!in_array(Language::TYPE_CONTENT, $configurable)) { $configurable[] = Language::TYPE_CONTENT; - Drupal::config('system.language.types')->set('configurable', $configurable)->save(); + \Drupal::config('system.language.types')->set('configurable', $configurable)->save(); } } } @@ -59,7 +59,7 @@ function language_test_language_types_info_alter(array &$language_types) { * Implements hook_language_negotiation_info(). */ function language_test_language_negotiation_info() { - if (Drupal::state()->get('language_test.language_negotiation_info')) { + if (\Drupal::state()->get('language_test.language_negotiation_info')) { $info = array( 'callbacks' => array( 'negotiation' => 'language_test_language_negotiation_method', @@ -86,7 +86,7 @@ function language_test_language_negotiation_info() { * Implements hook_language_negotiation_info_alter(). */ function language_test_language_negotiation_info_alter(array &$negotiation_info) { - if (Drupal::state()->get('language_test.language_negotiation_info_alter')) { + if (\Drupal::state()->get('language_test.language_negotiation_info_alter')) { unset($negotiation_info[LANGUAGE_NEGOTIATION_INTERFACE]); } } @@ -100,7 +100,7 @@ function language_test_store_language_negotiation() { foreach (language_types_get_all() as $type) { $last[$type] = language($type)->id; } - Drupal::state()->set('language_test.language_negotiation_last', $last); + \Drupal::state()->set('language_test.language_negotiation_last', $last); } /** diff --git a/core/modules/locale/locale.batch.inc b/core/modules/locale/locale.batch.inc index 008cb50..d789ea2 100644 --- a/core/modules/locale/locale.batch.inc +++ b/core/modules/locale/locale.batch.inc @@ -94,7 +94,7 @@ function locale_translation_batch_status_check($project, $langcode, $options = a function locale_translation_batch_status_finished($success, $results) { if ($success) { if (isset($results['failed_files'])) { - if (Drupal::moduleHandler()->moduleExists('dblog')) { + if (\Drupal::moduleHandler()->moduleExists('dblog')) { $message = format_plural(count($results['failed_files']), 'One translation file could not be checked. See the log for details.', '@count translation files could not be checked. See the log for details.', array('@url' => url('admin/reports/dblog'))); } else { @@ -112,7 +112,7 @@ function locale_translation_batch_status_finished($success, $results) { if (!isset($results['failed_files']) && !isset($results['files'])) { drupal_set_message(t('Nothing to check.')); } - Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); + \Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); } else { drupal_set_message(t('An error occurred trying to check available interface translation updates.'), 'error'); @@ -210,7 +210,7 @@ function locale_translation_batch_fetch_import($project, $langcode, $options, &$ function locale_translation_batch_fetch_finished($success, $results) { module_load_include('bulk.inc', 'locale'); if ($success) { - Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); + \Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); } return locale_translate_batch_finished($success, $results); } @@ -231,7 +231,7 @@ function locale_translation_batch_fetch_finished($success, $results) { function locale_translation_http_check($uri) { try { - $response = Drupal::httpClient() + $response = \Drupal::httpClient() ->head($uri) ->send(); $result = array(); diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc index 55c3aed..355ccb1 100644 --- a/core/modules/locale/locale.bulk.inc +++ b/core/modules/locale/locale.bulk.inc @@ -243,7 +243,7 @@ function locale_translate_export_form_submit($form, &$form_state) { if (!empty($item)) { $uri = tempnam('temporary://', 'po_'); $header = $reader->getHeader(); - $header->setProjectName(Drupal::config('system.site')->get('name')); + $header->setProjectName(\Drupal::config('system.site')->get('name')); $header->setLanguageName($languageName); $writer = new PoStreamWriter; @@ -258,7 +258,7 @@ function locale_translate_export_form_submit($form, &$form_state) { $response = new BinaryFileResponse($uri); $response->setContentDisposition('attachment', $filename); // @todo remove lines below once converted to new routing system. - $response->prepare(Drupal::request()) + $response->prepare(\Drupal::request()) ->send(); } else { @@ -348,7 +348,7 @@ function locale_translate_get_interface_translation_files($projects = array(), $ // containing a project name and language code: {project}.{langcode}.po or // {project}-{version}.{langcode}.po. // Only files of known projects and languages will be returned. - $directory = Drupal::config('locale.settings')->get('translation.path'); + $directory = \Drupal::config('locale.settings')->get('translation.path'); $result = file_scan_directory($directory, '![a-z_]+(\-[0-9a-z\.\-\+]+|)\.[^\./]+\.po$!', array('recurse' => FALSE)); foreach ($result as $file) { @@ -602,7 +602,7 @@ function locale_translate_batch_finished($success, $results) { if ($success) { $additions = $updates = $deletes = $skips = $config = 0; if (isset($results['failed_files'])) { - if (Drupal::moduleHandler()->moduleExists('dblog')) { + if (\Drupal::moduleHandler()->moduleExists('dblog')) { $message = format_plural(count($results['failed_files']), 'One translation file could not be imported. See the log for details.', '@count translation files could not be imported. See the log for details.', array('@url' => url('admin/reports/dblog'))); } else { @@ -633,7 +633,7 @@ function locale_translate_batch_finished($success, $results) { watchdog('locale', 'Translations imported: %number added, %update updated, %delete removed.', array('%number' => $additions, '%update' => $updates, '%delete' => $deletes)); if ($skips) { - if (Drupal::moduleHandler()->moduleExists('dblog')) { + if (\Drupal::moduleHandler()->moduleExists('dblog')) { $message = format_plural($skips, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.', array('@url' => url('admin/reports/dblog'))); } else { @@ -799,7 +799,7 @@ function locale_config_batch_build(array $names, array $langcodes, $options = ar $batch_names[] = $name; $i++; // During installation the caching of configuration objects is disabled - // so it is very expensive to initialize the Drupal::config() object on each request. + // so it is very expensive to initialize the \Drupal::config() object on each request. // We batch a small number of configuration object upgrades together to // improve the overall performance of the process. if ($i % 20 == 0) { diff --git a/core/modules/locale/locale.compare.inc b/core/modules/locale/locale.compare.inc index db2918f..2760760 100644 --- a/core/modules/locale/locale.compare.inc +++ b/core/modules/locale/locale.compare.inc @@ -20,7 +20,7 @@ */ function locale_translation_flush_projects() { // Followup issue: http://drupal.org/node/1842362 - // Replace {locale_project} table by Drupal::state() variable(s). + // Replace {locale_project} table by \Drupal::state() variable(s). db_truncate('locale_project')->execute(); } @@ -47,7 +47,7 @@ function locale_translation_flush_projects() { */ function locale_translation_build_projects() { // This function depends on Update module. We degrade gracefully. - if (!Drupal::moduleHandler()->moduleExists('update')) { + if (!\Drupal::moduleHandler()->moduleExists('update')) { return array(); } @@ -92,7 +92,7 @@ function locale_translation_build_projects() { // For every project store information. $data += array( 'version' => isset($data['info']['version']) ? $data['info']['version'] : '', - 'core' => isset($data['info']['core']) ? $data['info']['core'] : Drupal::CORE_COMPATIBILITY, + 'core' => isset($data['info']['core']) ? $data['info']['core'] : \Drupal::CORE_COMPATIBILITY, // A project can provide the path and filename pattern to download the // gettext file. Use the default if not. 'server_pattern' => isset($data['info']['interface translation server pattern']) && $data['info']['interface translation server pattern'] ? $data['info']['interface translation server pattern'] : $default_server['pattern'], @@ -130,7 +130,7 @@ function locale_translation_project_list() { $projects = &drupal_static(__FUNCTION__, array()); if (empty($projects)) { module_load_include('compare.inc', 'update'); - $config = Drupal::config('locale.settings'); + $config = \Drupal::config('locale.settings'); $projects = array(); $additional_whitelist = array( @@ -195,9 +195,9 @@ function _locale_translation_prepare_project_list($data, $type) { * - "server_pattern": URI containing po file pattern. */ function locale_translation_default_translation_server() { - $pattern = Drupal::config('locale.settings')->get('translation.default_server_pattern'); + $pattern = \Drupal::config('locale.settings')->get('translation.default_server_pattern'); // An additional check is required here. During the upgrade process - // Drupal::config()->get() returns NULL. We use the defined value as fallback. + // \Drupal::config()->get() returns NULL. We use the defined value as fallback. $pattern = $pattern ? $pattern : LOCALE_TRANSLATION_DEFAULT_SERVER_PATTERN; return array( @@ -226,7 +226,7 @@ function locale_translation_check_projects($projects = array(), $langcodes = arr else { // Retrieve and save the status of local translations only. locale_translation_check_projects_local($projects, $langcodes); - Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); + \Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); } } diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 1e62cd4..d10791c 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -12,9 +12,9 @@ */ function locale_install() { // Create the interface translations directory and ensure it's writable. - if (!$directory = Drupal::config('locale.settings')->get('translation.path')) { + if (!$directory = \Drupal::config('locale.settings')->get('translation.path')) { $directory = conf_path() . '/files/translations'; - Drupal::config('locale.settings')->set('translation.path', $directory)->save(); + \Drupal::config('locale.settings')->set('translation.path', $directory)->save(); } file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); } @@ -23,12 +23,12 @@ function locale_install() { * Implements hook_uninstall(). */ function locale_uninstall() { - $config = Drupal::config('locale.settings'); + $config = \Drupal::config('locale.settings'); // Delete all JavaScript translation files. $locale_js_directory = 'public://' . $config->get('javascript.directory'); if (is_dir($locale_js_directory)) { - $locale_javascripts = Drupal::state()->get('locale.translation.javascript') ?: array(); + $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array(); foreach ($locale_javascripts as $langcode => $file_suffix) { if (!empty($file_suffix)) { file_unmanaged_delete($locale_js_directory . '/' . $langcode . '_' . $file_suffix . '.js'); @@ -41,9 +41,9 @@ function locale_uninstall() { } // Clear variables. - Drupal::state()->delete('system.javascript_parsed'); - Drupal::state()->delete('locale.translation.plurals'); - Drupal::state()->delete('locale.translation.javascript'); + \Drupal::state()->delete('system.javascript_parsed'); + \Drupal::state()->delete('locale.translation.plurals'); + \Drupal::state()->delete('locale.translation.javascript'); // Remove all node type language variables. Node module might have been // enabled, but may be disabled, so use a wildcard delete. @@ -468,7 +468,7 @@ function locale_update_8002() { */ function locale_update_8003() { $message = ''; - $config = Drupal::config('language.negotiation'); + $config = \Drupal::config('language.negotiation'); $domains = $config->get('url.domains') ?: array(); // $used_domains keeps track of the domain names in use. @@ -953,7 +953,7 @@ function locale_update_8016() { foreach ($result as $format) { $language = $format->language; // Create config objects for the language if not yet done. - Drupal::config("locale.config.$language.system.date_format." . $format->type) + \Drupal::config("locale.config.$language.system.date_format." . $format->type) ->set('pattern.php', $format->format) ->save(); } diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 1b34406..a7898f7 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -292,7 +292,7 @@ function locale_language_update($language) { */ function locale_language_delete($language) { // Remove translations. - Drupal::service('locale.storage')->deleteTranslations(array('language' => $language->id)); + \Drupal::service('locale.storage')->deleteTranslations(array('language' => $language->id)); // Remove interface translation files. module_load_include('inc', 'locale', 'locale.bulk'); @@ -354,7 +354,7 @@ function locale_get_plural($count, $langcode = NULL) { if (!isset($plural_indexes[$langcode][$count])) { // Retrieve and statically cache the plural formulas for all languages. if (empty($plural_formulas)) { - $plural_formulas = Drupal::state()->get('locale.translation.plurals') ?: array(); + $plural_formulas = \Drupal::state()->get('locale.translation.plurals') ?: array(); } // If there is a plural formula for the language, evaluate it for the given // $count and statically cache the result for the combination of language @@ -424,7 +424,7 @@ function locale_cron() { // and a translatable language was set. // Update tasks are added to the queue here but processed by Drupal's cron // using the cron worker defined in locale_queue_info(). - if ($frequency = Drupal::config('locale.settings')->get('translation.update_interval_days') && locale_translatable_language_list()) { + if ($frequency = \Drupal::config('locale.settings')->get('translation.update_interval_days') && locale_translatable_language_list()) { module_load_include('translation.inc', 'locale'); locale_cron_fill_queue(); } @@ -494,7 +494,7 @@ function locale_translation_worker($data) { // continue the task. This is typically the translation import task. if ($batch_context['finished'] < 1) { unset($batch_context['strings']); - $queue = Drupal::queue('locale_translation', TRUE); + $queue = \Drupal::queue('locale_translation', TRUE); $queue->createItem(array($function, $args)); } } @@ -516,7 +516,7 @@ function locale_system_update(array $components) { // Skip running the translation imports if in the installer, // because it would break out of the installer flow. We have // built-in support for translation imports in the installer. - if (!drupal_installation_attempted() && locale_translatable_language_list() && Drupal::config('locale.settings')->get('translation.import_enabled')) { + if (!drupal_installation_attempted() && locale_translatable_language_list() && \Drupal::config('locale.settings')->get('translation.import_enabled')) { module_load_include('compare.inc', 'locale'); // Update the list of translatable projects and start the import batch. @@ -530,7 +530,7 @@ function locale_system_update(array $components) { $batch = locale_translation_batch_update_build($list, array(), $options); batch_set($batch); } - Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); + \Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); if ($batch = locale_config_batch_update_components(array(), array(), $components)) { batch_set($batch); } @@ -553,7 +553,7 @@ function locale_system_remove($components) { $list = array_merge($components['module'], $components['theme']); if ($language_list = locale_translatable_language_list()) { module_load_include('compare.inc', 'locale'); - Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); + \Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); // Delete configuration translations. \Drupal\locale\Locale::config()->deleteComponentTranslations($components, array_keys($language_list)); @@ -612,8 +612,8 @@ function locale_js_alter(&$javascript) { function locale_js_translate(array $files = array()) { $language_interface = language(Language::TYPE_INTERFACE); - $dir = 'public://' . Drupal::config('locale.settings')->get('javascript.directory'); - $parsed = Drupal::state()->get('system.javascript_parsed') ?: array(); + $dir = 'public://' . \Drupal::config('locale.settings')->get('javascript.directory'); + $parsed = \Drupal::state()->get('system.javascript_parsed') ?: array(); $new_files = FALSE; foreach ($files as $filepath) { @@ -642,16 +642,16 @@ function locale_js_translate(array $files = array()) { unset($parsed['refresh:' . $language_interface->id]); } // Store any changes after refresh was attempted. - Drupal::state()->set('system.javascript_parsed', $parsed); + \Drupal::state()->set('system.javascript_parsed', $parsed); } // If no refresh was attempted, but we have new source files, we need // to store them too. This occurs if current page is in English. elseif ($new_files) { - Drupal::state()->set('system.javascript_parsed', $parsed); + \Drupal::state()->set('system.javascript_parsed', $parsed); } // Add the translation JavaScript file to the page. - $locale_javascripts = Drupal::state()->get('translation.javascript') ?: array(); + $locale_javascripts = \Drupal::state()->get('translation.javascript') ?: array(); $translation_file = NULL; if (!empty($files) && !empty($locale_javascripts[$language_interface->id])) { // Add the translation JavaScript file to the page. @@ -666,7 +666,7 @@ function locale_js_translate(array $files = array()) { function locale_library_info() { $libraries['drupal.locale.admin'] = array( 'title' => 'Locale', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'locale') . '/locale.admin.js' => array(), ), @@ -678,7 +678,7 @@ function locale_library_info() { ); $libraries['drupal.locale.datepicker'] = array( 'title' => 'Locale Datepicker UI', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'locale') . '/locale.datepicker.js' => array(), ), @@ -710,7 +710,7 @@ function locale_library_info_alter(&$libraries, $module) { 'ui' => array( 'datepicker' => array( 'isRTL' => $language_interface->direction == Language::DIRECTION_RTL, - 'firstDay' => Drupal::config('system.date')->get('first_day'), + 'firstDay' => \Drupal::config('system.date')->get('first_day'), ), ), ), @@ -726,12 +726,12 @@ function locale_library_info_alter(&$libraries, $module) { function locale_form_language_admin_overview_form_alter(&$form, &$form_state) { $languages = $form['languages']['#languages']; - $total_strings = Drupal::service('locale.storage')->countStrings(); + $total_strings = \Drupal::service('locale.storage')->countStrings(); $stats = array_fill_keys(array_keys($languages), array()); // If we have source strings, count translations and calculate progress. if (!empty($total_strings)) { - $translations = Drupal::service('locale.storage')->countTranslations(); + $translations = \Drupal::service('locale.storage')->countTranslations(); foreach ($translations as $langcode => $translated) { $stats[$langcode]['translated'] = $translated; if ($translated > 0) { @@ -787,7 +787,7 @@ function locale_form_language_admin_add_form_alter(&$form, &$form_state) { * Set a batch for a newly-added language. */ function locale_form_language_admin_add_form_alter_submit($form, $form_state) { - if (Drupal::config('locale.settings')->get('translation.import_enabled')) { + if (\Drupal::config('locale.settings')->get('translation.import_enabled')) { if (empty($form_state['values']['predefined_langcode']) || $form_state['values']['predefined_langcode'] == 'custom') { $langcode = $form_state['values']['langcode']; } @@ -802,7 +802,7 @@ function locale_form_language_admin_add_form_alter_submit($form, $form_state) { batch_set($batch); // Create or update all configuration translations for this language. - Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); + \Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); if ($batch = locale_config_batch_update_components($options, array($langcode))) { batch_set($batch); } @@ -849,7 +849,7 @@ function locale_form_system_file_system_settings_alter(&$form, $form_state) { $form['translation_path'] = array( '#type' => 'textfield', '#title' => t('Interface translations directory'), - '#default_value' => Drupal::config('locale.settings')->get('translation.path'), + '#default_value' => \Drupal::config('locale.settings')->get('translation.path'), '#maxlength' => 255, '#description' => t('A local file system path where interface translation files will be stored.'), '#required' => TRUE, @@ -874,7 +874,7 @@ function locale_system_file_system_settings_submit(&$form, $form_state) { locale_translation_clear_status(); } - Drupal::config('locale.settings') + \Drupal::config('locale.settings') ->set('translation.path', $form_state['values']['translation_path']) ->save(); } @@ -975,7 +975,7 @@ function locale_translation_file_history_delete($projects = array(), $langcodes */ function locale_translation_get_status($projects = NULL, $langcodes = NULL) { $result = array(); - $status = Drupal::state()->get('locale.translation_status'); + $status = \Drupal::state()->get('locale.translation_status'); module_load_include('translation.inc', 'locale'); $projects = $projects ? $projects : array_keys(locale_translation_get_projects()); $langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list()); @@ -1052,8 +1052,8 @@ function locale_translation_status_save($project, $langcode, $type, $data) { break; } - Drupal::state()->set('locale.translation_status', $status); - Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); + \Drupal::state()->set('locale.translation_status', $status); + \Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); } } @@ -1072,7 +1072,7 @@ function locale_translation_status_delete_languages($langcodes) { } } } - Drupal::state()->set('locale.translation_status', $status); + \Drupal::state()->set('locale.translation_status', $status); } } @@ -1090,15 +1090,15 @@ function locale_translation_status_delete_projects($projects) { unset($status[$project]); } } - Drupal::state()->set('locale.translation_status', $status); + \Drupal::state()->set('locale.translation_status', $status); } /** * Clear the translation status cache. */ function locale_translation_clear_status() { - Drupal::state()->delete('locale.translation_status'); - Drupal::state()->delete('locale.translation_last_checked'); + \Drupal::state()->delete('locale.translation_status'); + \Drupal::state()->delete('locale.translation_last_checked'); } /** @@ -1109,7 +1109,7 @@ function locale_translation_clear_status() { * when checking or importing translation files, FALSE otherwise. */ function locale_translation_use_remote_source() { - return Drupal::config('locale.settings')->get('translation.use_source') == LOCALE_TRANSLATION_USE_SOURCE_REMOTE_AND_LOCAL; + return \Drupal::config('locale.settings')->get('translation.use_source') == LOCALE_TRANSLATION_USE_SOURCE_REMOTE_AND_LOCAL; } /** @@ -1147,7 +1147,7 @@ function _locale_refresh_translations($langcodes, $lids = array()) { if (!empty($langcodes)) { // Update javascript translations if any of the strings has a javascript // location, or if no string ids were provided, update all languages. - if (empty($lids) || ($strings = Drupal::service('locale.storage')->getStrings(array('lid' => $lids, 'type' => 'javascript')))) { + if (empty($lids) || ($strings = \Drupal::service('locale.storage')->getStrings(array('lid' => $lids, 'type' => 'javascript')))) { array_map('_locale_invalidate_js', $langcodes); } } @@ -1169,7 +1169,7 @@ function _locale_refresh_translations($langcodes, $lids = array()) { */ function _locale_refresh_configuration(array $langcodes, array $lids) { if ($lids && $langcodes && $names = \Drupal\locale\Locale::config()->getStringNames($lids)) { - Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); + \Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc'); locale_config_update_multiple($names, $langcodes); } } @@ -1267,11 +1267,11 @@ function _locale_parse_js_file($filepath) { $string = implode('', preg_split('~(?findString(array('source' => $string, 'context' => $context)); + $source = \Drupal::service('locale.storage')->findString(array('source' => $string, 'context' => $context)); if (!$source) { // We don't have the source string yet, thus we insert it into the database. - $source = Drupal::service('locale.storage')->createString(array( + $source = \Drupal::service('locale.storage')->createString(array( 'source' => $string, 'context' => $context, )); @@ -1297,7 +1297,7 @@ function _locale_parse_js_file($filepath) { * New content of the 'system.javascript_parsed' variable. */ function _locale_invalidate_js($langcode = NULL) { - $parsed = Drupal::state()->get('system.javascript_parsed') ?: array(); + $parsed = \Drupal::state()->get('system.javascript_parsed') ?: array(); if (empty($langcode)) { // Invalidate all languages. @@ -1311,7 +1311,7 @@ function _locale_invalidate_js($langcode = NULL) { $parsed['refresh:' . $langcode] = 'waiting'; } - Drupal::state()->set('system.javascript_parsed', $parsed); + \Drupal::state()->set('system.javascript_parsed', $parsed); return $parsed; } @@ -1322,7 +1322,7 @@ function _locale_invalidate_js($langcode = NULL) { * The language, the translation file should be (re)created for. */ function _locale_rebuild_js($langcode = NULL) { - $config = Drupal::config('locale.settings'); + $config = \Drupal::config('locale.settings'); if (!isset($langcode)) { $language = language(Language::TYPE_INTERFACE); } @@ -1340,7 +1340,7 @@ function _locale_rebuild_js($langcode = NULL) { 'translated' => TRUE, ); $translations = array(); - foreach (Drupal::service('locale.storage')->getTranslations($conditions) as $data) { + foreach (\Drupal::service('locale.storage')->getTranslations($conditions) as $data) { $translations[$data->context][$data->source] = $data->translation; } @@ -1350,7 +1350,7 @@ function _locale_rebuild_js($langcode = NULL) { if (!empty($translations)) { $data = "Drupal.locale = { "; - $locale_plurals = Drupal::state()->get('locale.translation.plurals') ?: array(); + $locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array(); if (!empty($locale_plurals[$language->id])) { $data .= "'pluralFormula': function (\$n) { return Number({$locale_plurals[$language->id]['formula']}); }, "; } @@ -1364,7 +1364,7 @@ function _locale_rebuild_js($langcode = NULL) { $dir = 'public://' . $config->get('javascript.directory'); // Delete old file, if we have no translations anymore, or a different file to be saved. - $locale_javascripts = Drupal::state()->get('locale.translation.javascript') ?: array(); + $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array(); $changed_hash = !isset($locale_javascripts[$language->id]) || ($locale_javascripts[$language->id] != $data_hash); if (!empty($locale_javascripts[$language->id]) && (!$data || $changed_hash)) { file_unmanaged_delete($dir . '/' . $language->id . '_' . $locale_javascripts[$language->id] . '.js'); @@ -1408,7 +1408,7 @@ function _locale_rebuild_js($langcode = NULL) { // deleted). Act only if some operation was executed that changed the hash // code. if ($status && $changed_hash) { - Drupal::state()->set('locale.translation.javascript', $locale_javascripts); + \Drupal::state()->set('locale.translation.javascript', $locale_javascripts); } // Log the operation and return success flag. diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index fbc5c59..1e045fe 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -112,7 +112,7 @@ function locale_translation_status_form($form, &$form_state) { }); } - $last_checked = Drupal::state()->get('locale.translation_last_checked'); + $last_checked = \Drupal::state()->get('locale.translation_last_checked'); $form['last_checked'] = array( '#theme' => 'locale_translation_last_check', '#last' => $last_checked, @@ -197,7 +197,7 @@ function locale_translation_status_form_submit($form, &$form_state) { // If the status was updated recently we can immediately start fetching the // translation updates. If the status is expired we clear it an run a batch to // update the status and then fetch the translation updates. - $last_checked = Drupal::state()->get('locale.translation_last_checked'); + $last_checked = \Drupal::state()->get('locale.translation_last_checked'); if ($last_checked < REQUEST_TIME - LOCALE_TRANSLATION_STATUS_TTL) { locale_translation_clear_status(); $batch = locale_translation_batch_update_build(array(), $langcodes, $options); diff --git a/core/modules/locale/locale.translation.inc b/core/modules/locale/locale.translation.inc index 30c7b0f..bb91542 100644 --- a/core/modules/locale/locale.translation.inc +++ b/core/modules/locale/locale.translation.inc @@ -58,7 +58,7 @@ function locale_translation_get_projects($project_names = array()) { // http://drupal.org/node/1777106 is a follow-up issue to make the check for // possible out-of-date project information more robust. - if ($result->rowCount() == 0 && Drupal::moduleHandler()->moduleExists('update')) { + if ($result->rowCount() == 0 && \Drupal::moduleHandler()->moduleExists('update')) { module_load_include('compare.inc', 'locale'); // At least the core project should be in the database, so we build the // data if none are found. @@ -236,7 +236,7 @@ function locale_translation_source_build($project, $langcode, $filename = NULL) $source->timestamp = 0; $source->last_checked = 0; - $filename = $filename ? $filename : Drupal::config('locale.settings')->get('translation.default_filename'); + $filename = $filename ? $filename : \Drupal::config('locale.settings')->get('translation.default_filename'); // If the server_pattern contains a remote file path we will check for a // remote file. The local version of this file will only be checked if a @@ -322,7 +322,7 @@ function locale_translation_build_server_pattern($project, $template) { */ function locale_cron_fill_queue() { $updates = array(); - $config = Drupal::config('locale.settings'); + $config = \Drupal::config('locale.settings'); // Determine which project+language should be updated. $last = REQUEST_TIME - $config->get('translation.update_interval_days') * 3600 * 24; @@ -351,7 +351,7 @@ function locale_cron_fill_queue() { if ($updates) { module_load_include('fetch.inc', 'locale'); $options = _locale_translation_default_update_options(); - $queue = Drupal::queue('locale_translation', TRUE); + $queue = \Drupal::queue('locale_translation', TRUE); foreach ($updates as $project => $languages) { $batch = locale_translation_batch_update_build(array($project), $languages, $options); @@ -425,7 +425,7 @@ function _locale_translation_source_compare($source1, $source2) { * Array of translation import options. */ function _locale_translation_default_update_options() { - $config = Drupal::config('locale.settings'); + $config = \Drupal::config('locale.settings'); return array( 'customized' => LOCALE_NOT_CUSTOMIZED, 'overwrite_options' => array( diff --git a/core/modules/locale/tests/modules/locale_test/locale_test.install b/core/modules/locale/tests/modules/locale_test/locale_test.install index e820b9f..be5ad52 100644 --- a/core/modules/locale/tests/modules/locale_test/locale_test.install +++ b/core/modules/locale/tests/modules/locale_test/locale_test.install @@ -10,6 +10,6 @@ */ function locale_test_uninstall() { // Clear variables. - Drupal::state()->delete('locale.test_system_info_alter'); - Drupal::state()->delete('locale.test_projects_alter'); + \Drupal::state()->delete('locale.test_system_info_alter'); + \Drupal::state()->delete('locale.test_projects_alter'); } diff --git a/core/modules/locale/tests/modules/locale_test/locale_test.module b/core/modules/locale/tests/modules/locale_test/locale_test.module index 6de4ce6..166983a 100644 --- a/core/modules/locale/tests/modules/locale_test/locale_test.module +++ b/core/modules/locale/tests/modules/locale_test/locale_test.module @@ -17,7 +17,7 @@ function locale_test_system_info_alter(&$info, $file, $type) { // By default the locale_test modules are hidden and have a project specified. // To test the module detection proces by locale_project_list() the // test modules should mimic a custom module. I.e. be non-hidden. - if (Drupal::state()->get('locale.test_system_info_alter')) { + if (\Drupal::state()->get('locale.test_system_info_alter')) { if ($file->name == 'locale_test' || $file->name == 'locale_test_translate') { // Don't hide the module. $info['hidden'] = FALSE; @@ -38,7 +38,7 @@ function locale_test_system_info_alter(&$info, $file, $type) { * test script in order for this hook to take effect. */ function locale_test_locale_translation_projects_alter(&$projects) { - if (Drupal::state()->get('locale.test_projects_alter')) { + if (\Drupal::state()->get('locale.test_projects_alter')) { // Instead of the default ftp.drupal.org we use the file system of the test // instance to simulate a remote file location. diff --git a/core/modules/menu/menu.install b/core/modules/menu/menu.install index 36e6302..ac395f9 100644 --- a/core/modules/menu/menu.install +++ b/core/modules/menu/menu.install @@ -80,7 +80,7 @@ function menu_update_8004() { $result = db_query('SELECT * FROM {menu_custom}'); foreach ($result as $menu) { // Save the config object. - Drupal::config('system.menu.' . $menu->menu_name) + \Drupal::config('system.menu.' . $menu->menu_name) ->set('id', $menu->menu_name) ->set('uuid', $uuid->generate()) ->set('label', $menu->title) diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 57f39b6..64dc0f8 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -143,7 +143,7 @@ function menu_entity_bundle_info() { $bundles = array(); $config_names = config_get_storage_names_with_prefix('system.menu.'); foreach ($config_names as $config_name) { - $config = Drupal::config($config_name); + $config = \Drupal::config($config_name); $bundles['menu_link'][$config->get('id')] = array( 'label' => $config->get('label'), ); @@ -182,7 +182,7 @@ function menu_theme() { * Add a link for each custom menu. */ function menu_enable() { - 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); @@ -200,7 +200,7 @@ function menu_enable() { $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(); @@ -231,12 +231,12 @@ function menu_menu_insert(Menu $menu) { menu_cache_clear_all(); // Invalidate the block cache to update menu-based derivatives. if (module_exists('block')) { - Drupal::service('plugin.manager.block')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } // Make sure the menu is present in the active menus variable so that its // items may appear in the menu active trail. // See menu_set_active_menu_names(). - $config = Drupal::config('system.menu'); + $config = \Drupal::config('system.menu'); $active_menus = $config->get('active_menus_default') ?: array_keys(menu_get_menus()); if (!in_array($menu->id(), $active_menus)) { @@ -254,7 +254,7 @@ function menu_menu_update(Menu $menu) { menu_cache_clear_all(); // Invalidate the block cache to update menu-based derivatives. if (module_exists('block')) { - Drupal::service('plugin.manager.block')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } } @@ -283,7 +283,7 @@ function menu_menu_delete(Menu $menu) { // Invalidate the block cache to update menu-based derivatives. if (module_exists('block')) { - Drupal::service('plugin.manager.block')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } } @@ -312,7 +312,7 @@ function menu_parent_options(array $menus, MenuLink $menu_link = NULL, $type = N // allow contrib modules to provide more scalable pattern choosers. // hook_form_alter is too late in itself because all the possible parents are // retrieved here, unless override_parent_selector is set to TRUE. - if (Drupal::config('menu.settings')->get('override_parent_selector')) { + if (\Drupal::config('menu.settings')->get('override_parent_selector')) { return array(); } @@ -444,7 +444,7 @@ function menu_node_save(EntityInterface $node) { */ function menu_node_predelete(EntityInterface $node) { // Delete all menu module links that point to this node. - $query = Drupal::entityQuery('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('link_path', 'node/' . $node->id()) ->condition('module', 'menu'); $result = $query->execute(); @@ -467,7 +467,7 @@ function menu_node_prepare_form(NodeInterface $node, $form_display, $operation, // Give priority to the default menu $type_menus = variable_get('menu_options_' . $node->getType(), array('main' => 'main')); if (in_array($menu_name, $type_menus)) { - $query = Drupal::entityQuery('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('link_path', 'node/' . $node->id()) ->condition('menu_name', $menu_name) ->condition('module', 'menu') @@ -479,7 +479,7 @@ function menu_node_prepare_form(NodeInterface $node, $form_display, $operation, } // Check all allowed menus if a link does not exist in the default menu. if (!$mlid && !empty($type_menus)) { - $query = Drupal::entityQuery('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('link_path', 'node/' . $node->id()) ->condition('menu_name', array_values($type_menus), 'IN') ->condition('module', 'menu') @@ -714,7 +714,7 @@ function menu_preprocess_block(&$variables) { function menu_library_info() { $libraries['drupal.menu'] = array( 'title' => 'Menu', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'menu') . '/menu.js' => array(), ), @@ -726,7 +726,7 @@ function menu_library_info() { ); $libraries['drupal.menu.admin'] = array( 'title' => 'Menu admin', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'menu') . '/menu.admin.js' => array(), ), diff --git a/core/modules/menu_link/menu_link.module b/core/modules/menu_link/menu_link.module index 105e502..85d8e92 100644 --- a/core/modules/menu_link/menu_link.module +++ b/core/modules/menu_link/menu_link.module @@ -96,10 +96,10 @@ function menu_link_delete_multiple(array $mlids, $force = FALSE, $prevent_repare return; } - $controller = Drupal::entityManager() + $controller = \Drupal::entityManager() ->getStorageController('menu_link'); if (!$force) { - $entity_query = Drupal::entityQuery('menu_link'); + $entity_query = \Drupal::entityQuery('menu_link'); $group = $entity_query->orConditionGroup() ->condition('module', 'system', '<>') ->condition('updated', 0, '<>'); @@ -151,7 +151,7 @@ function menu_link_save(MenuLink $menu_link) { * The insert op returns the mlid of the new item. Others op return NULL. */ function menu_link_maintain($module, $op, $link_path, $link_title = NULL) { - $menu_link_controller = Drupal::entityManager() + $menu_link_controller = \Drupal::entityManager() ->getStorageController('menu_link'); switch ($op) { case 'insert': @@ -188,7 +188,7 @@ function menu_link_maintain($module, $op, $link_path, $link_title = NULL) { break; case 'delete': - $result = Drupal::entityQuery('menu_link')->condition('link_path', $link_path)->execute(); + $result = \Drupal::entityQuery('menu_link')->condition('link_path', $link_path)->execute(); if (!empty($result)) { menu_link_delete_multiple($result); } diff --git a/core/modules/node/node.install b/core/modules/node/node.install index 02cc7a0..7fb28bf 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -418,8 +418,8 @@ function node_uninstall() { // Delete node type variables. $types = config_get_storage_names_with_prefix('node.type.'); foreach ($types as $config_name) { - $type = Drupal::config($config_name)->get('type'); - Drupal::config('language.settings')->clear('node. ' . $type . '.language.default_configuration')->save(); + $type = \Drupal::config($config_name)->get('type'); + \Drupal::config('language.settings')->clear('node. ' . $type . '.language.default_configuration')->save(); } // Delete node search ranking variables. @@ -429,11 +429,11 @@ function node_uninstall() { variable_del('node_rank_recent'); // Delete remaining general module variables. - Drupal::state()->delete('node.node_access_needs_rebuild'); + \Drupal::state()->delete('node.node_access_needs_rebuild'); variable_del('node_recent_block_count'); // Delete any stored state. - Drupal::state()->delete('node.cron_last'); + \Drupal::state()->delete('node.cron_last'); } /** @@ -639,7 +639,7 @@ function node_update_8007() { $language_show = update_variable_get('node_type_language_show_' . $type, NULL); if (isset($language_default) || isset($language_show)) { $values = array('langcode' => $language_default, 'language_show' => $language_show); - Drupal::config('language.settings')->set('node.' . $type . '.language.default_configuration', $values)->save(); + \Drupal::config('language.settings')->set('node.' . $type . '.language.default_configuration', $values)->save(); } } } @@ -1075,7 +1075,7 @@ function node_update_8020() { $result = db_query('SELECT * FROM {node_type}') ->fetchAllAssoc('type', PDO::FETCH_ASSOC); foreach ($result as $id => $node_type) { - $config = Drupal::config('node.type.' . $id); + $config = \Drupal::config('node.type.' . $id); // Node type. $config->setData($node_type); $config->set('uuid', $uuid->generate()); @@ -1110,7 +1110,7 @@ function node_update_8020() { $locked[$id] = $node_type['base']; } } - Drupal::state()->set('node.type.locked', $locked); + \Drupal::state()->set('node.type.locked', $locked); } /** diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 80b2fed..aba2cfc 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -220,7 +220,7 @@ function node_uri(EntityInterface $node) { * Implements hook_admin_paths(). */ function node_admin_paths() { - if (Drupal::config('node.settings')->get('use_admin_theme')) { + if (\Drupal::config('node.settings')->get('use_admin_theme')) { $paths = array( 'node/*/edit' => TRUE, 'node/*/delete' => TRUE, @@ -326,7 +326,7 @@ function node_type_get_names() { $config_names = config_get_storage_names_with_prefix('node.type.'); $names = array(); foreach ($config_names as $config_name) { - $config = Drupal::config($config_name); + $config = \Drupal::config($config_name); $names[$config->get('type')] = $config->get('name'); } cache()->set($cid, $names, CacheBackendInterface::CACHE_PERMANENT, array( @@ -586,7 +586,7 @@ function node_show(EntityInterface $node, $message = FALSE) { // Update the history table, stating that this user viewed this node. global $user; - if (Drupal::moduleHandler()->moduleExists('history') && $user->isAuthenticated()) { + if (\Drupal::moduleHandler()->moduleExists('history') && $user->isAuthenticated()) { $page['#attached'] = array( 'js' => array( // When the window's "load" event is triggered, mark the node as read. @@ -684,7 +684,7 @@ function template_preprocess_node(&$variables) { // Display post information only on certain node types. // Avoid loading the entire node type config entity here. - $submitted = Drupal::config('node.type.' . $node->bundle())->get('settings.node.submitted') ?: TRUE; + $submitted = \Drupal::config('node.type.' . $node->bundle())->get('settings.node.submitted') ?: TRUE; if ($submitted) { $variables['display_submitted'] = TRUE; $variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date'])); @@ -808,7 +808,7 @@ function node_ranking() { ); // Add relevance based on creation or changed date. - if ($node_cron_last = Drupal::state()->get('node.cron_last')) { + if ($node_cron_last = \Drupal::state()->get('node.cron_last')) { $ranking['recent'] = array( 'title' => t('Recently posted'), // Exponential decay with half-life of 6 months, starting at last indexed node @@ -931,7 +931,7 @@ function theme_node_search_admin($variables) { * @see node_menu() */ function _node_revision_access(EntityInterface $node, $op = 'view', $account = NULL, $langcode = NULL) { - return Drupal::service('access_check.node.revision')->checkAccess($node, $op, $account, $langcode); + return \Drupal::service('access_check.node.revision')->checkAccess($node, $op, $account, $langcode); } /** @@ -1308,7 +1308,7 @@ function node_modules_uninstalled($modules) { // Remove module-specific settings from all node types. $config_names = config_get_storage_names_with_prefix('node.type.'); foreach ($config_names as $config_name) { - $config = Drupal::config($config_name); + $config = \Drupal::config($config_name); $changed = FALSE; foreach ($modules as $module) { if ($config->get('settings.' . $module)) { @@ -1391,7 +1391,7 @@ function node_block_access($block) { function node_feed($nids = FALSE, $channel = array()) { global $base_url; $language_content = language(Language::TYPE_CONTENT); - $rss_config = Drupal::config('system.rss'); + $rss_config = \Drupal::config('system.rss'); if ($nids === FALSE) { $nids = db_select('node_field_data', 'n') @@ -1443,7 +1443,7 @@ function node_feed($nids = FALSE, $channel = array()) { $channel_defaults = array( 'version' => '2.0', - 'title' => Drupal::config('system.site')->get('name'), + 'title' => \Drupal::config('system.site')->get('name'), 'link' => $base_url, 'description' => $rss_config->get('channel.description'), 'language' => $language_content->id @@ -1540,9 +1540,9 @@ function node_form_system_site_information_settings_form_alter(&$form, &$form_st $form['front_page']['default_nodes_main'] = array( '#type' => 'select', '#title' => t('Number of posts on front page'), - '#default_value' => Drupal::config('node.settings')->get('items_per_page'), + '#default_value' => \Drupal::config('node.settings')->get('items_per_page'), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), - '#access' => (Drupal::config('system.site')->get('page.front') == 'node'), + '#access' => (\Drupal::config('system.site')->get('page.front') == 'node'), '#description' => t('The maximum number of posts displayed on overview pages such as the front page.'), ); $form['#submit'][] = 'node_form_system_site_information_settings_form_submit'; @@ -1554,7 +1554,7 @@ function node_form_system_site_information_settings_form_alter(&$form, &$form_st * @see node_form_system_site_information_settings_form_alter() */ function node_form_system_site_information_settings_form_submit($form, &$form_state) { - Drupal::config('node.settings') + \Drupal::config('node.settings') ->set('items_per_page', $form_state['values']['default_nodes_main']) ->save(); } @@ -1570,7 +1570,7 @@ function node_form_system_themes_admin_form_alter(&$form, &$form_state, $form_id $form['admin_theme']['use_admin_theme'] = array( '#type' => 'checkbox', '#title' => t('Use the administration theme when editing or creating content'), - '#default_value' => Drupal::config('node.settings')->get('use_admin_theme'), + '#default_value' => \Drupal::config('node.settings')->get('use_admin_theme'), ); $form['#submit'][] = 'node_form_system_themes_admin_form_submit'; } @@ -1581,7 +1581,7 @@ function node_form_system_themes_admin_form_alter(&$form, &$form_state, $form_id * @see node_form_system_themes_admin_form_alter() */ function node_form_system_themes_admin_form_submit($form, &$form_state) { - Drupal::config('node.settings') + \Drupal::config('node.settings') ->set('use_admin_theme', $form_state['values']['use_admin_theme']) ->save(); } @@ -1656,7 +1656,7 @@ function node_form_system_themes_admin_form_submit($form, &$form_state) { * @see node_menu() */ function node_access($op, $node, $account = NULL, $langcode = NULL) { - $access_controller = Drupal::entityManager()->getAccessController('node'); + $access_controller = \Drupal::entityManager()->getAccessController('node'); if ($op == 'create') { if (!$node instanceof EntityInterface) { @@ -1801,7 +1801,7 @@ function node_access_grants($op, $account = NULL) { } // Fetch node access grants from other modules. - $grants = Drupal::moduleHandler()->invokeAll('node_grants', array($account, $op)); + $grants = \Drupal::moduleHandler()->invokeAll('node_grants', array($account, $op)); // Allow modules to alter the assigned grants. drupal_alter('node_grants', $grants, $account, $op); @@ -1843,11 +1843,11 @@ function node_access_view_all_nodes($account = NULL) { } // If no modules implement the node access system, access is always TRUE. - if (!Drupal::moduleHandler()->getImplementations('node_grants')) { + if (!\Drupal::moduleHandler()->getImplementations('node_grants')) { $access[$account->id()] = TRUE; } else { - $access[$account->id()] = Drupal::entityManager()->getAccessController('node')->checkAllGrants($account); + $access[$account->id()] = \Drupal::entityManager()->getAccessController('node')->checkAllGrants($account); } return $access[$account->id()]; @@ -1887,7 +1887,7 @@ function node_query_node_access_alter(AlterableInterface $query) { if (user_access('bypass node access', $account)) { return; } - if (!count(Drupal::moduleHandler()->getImplementations('node_grants'))) { + if (!count(\Drupal::moduleHandler()->getImplementations('node_grants'))) { return; } if ($op == 'view' && node_access_view_all_nodes($account)) { @@ -1915,7 +1915,7 @@ function node_query_node_access_alter(AlterableInterface $query) { } // Update the query for the given storage method. - Drupal::service('node.grant_storage')->alterQuery($query, $tables, $op, $account, $base_table); + \Drupal::service('node.grant_storage')->alterQuery($query, $tables, $op, $account, $base_table); } /** @@ -1940,13 +1940,13 @@ function node_query_node_access_alter(AlterableInterface $query) { */ function node_access_needs_rebuild($rebuild = NULL) { if (!isset($rebuild)) { - return Drupal::state()->get('node.node_access_needs_rebuild') ?: FALSE; + return \Drupal::state()->get('node.node_access_needs_rebuild') ?: FALSE; } elseif ($rebuild) { - Drupal::state()->set('node.node_access_needs_rebuild', TRUE); + \Drupal::state()->set('node.node_access_needs_rebuild', TRUE); } else { - Drupal::state()->delete('node.node_access_needs_rebuild'); + \Drupal::state()->delete('node.node_access_needs_rebuild'); } } @@ -1973,10 +1973,10 @@ function node_access_needs_rebuild($rebuild = NULL) { * @see node_access_needs_rebuild() */ function node_access_rebuild($batch_mode = FALSE) { - $access_controller = Drupal::entityManager()->getAccessController('node'); + $access_controller = \Drupal::entityManager()->getAccessController('node'); $access_controller->deleteGrants(); // Only recalculate if the site is using a node_access module. - if (count(Drupal::moduleHandler()->getImplementations('node_grants'))) { + if (count(\Drupal::moduleHandler()->getImplementations('node_grants'))) { if ($batch_mode) { $batch = array( 'title' => t('Rebuilding content access permissions'), @@ -1992,7 +1992,7 @@ function node_access_rebuild($batch_mode = FALSE) { drupal_set_time_limit(240); // Rebuild newest nodes first so that recent content becomes available quickly. - $entity_query = Drupal::entityQuery('node'); + $entity_query = \Drupal::entityQuery('node'); $entity_query->sort('nid', 'DESC'); $nids = $entity_query->execute(); foreach ($nids as $nid) { @@ -2032,12 +2032,12 @@ function _node_access_rebuild_batch_operation(&$context) { // Initiate multistep processing. $context['sandbox']['progress'] = 0; $context['sandbox']['current_node'] = 0; - $context['sandbox']['max'] = Drupal::entityQuery('node')->count()->execute(); + $context['sandbox']['max'] = \Drupal::entityQuery('node')->count()->execute(); } // Process the next 20 nodes. $limit = 20; - $nids = Drupal::entityQuery('node') + $nids = \Drupal::entityQuery('node') ->condition('nid', $context['sandbox']['current_node'], '>') ->sort('nid', 'DESC') ->range(0, $limit) @@ -2047,7 +2047,7 @@ function _node_access_rebuild_batch_operation(&$context) { // To preserve database integrity, only write grants if the node // loads successfully. if (!empty($node)) { - Drupal::entityManager()->getAccessController('node')->writeGrants($node); + \Drupal::entityManager()->getAccessController('node')->writeGrants($node); } $context['sandbox']['progress']++; $context['sandbox']['current_node'] = $nid; @@ -2093,8 +2093,8 @@ function node_requirements($phase) { // Only show rebuild button if there are either 0, or 2 or more, rows // in the {node_access} table, or if there are modules that // implement hook_node_grants(). - $grant_count = Drupal::entityManager()->getAccessController('node')->countGrants(); - if ($grant_count != 1 || count(Drupal::moduleHandler()->getImplementations('node_grants')) > 0) { + $grant_count = \Drupal::entityManager()->getAccessController('node')->countGrants(); + if ($grant_count != 1 || count(\Drupal::moduleHandler()->getImplementations('node_grants')) > 0) { $value = format_plural($grant_count, 'One permission in use', '@count permissions in use', array('@count' => $grant_count)); } else { @@ -2117,7 +2117,7 @@ function node_requirements($phase) { function node_modules_enabled($modules) { // Check if any of the newly enabled modules require the node_access table to // be rebuilt. - if (!node_access_needs_rebuild() && array_intersect($modules, Drupal::moduleHandler()->getImplementations('node_grants'))) { + if (!node_access_needs_rebuild() && array_intersect($modules, \Drupal::moduleHandler()->getImplementations('node_grants'))) { node_access_needs_rebuild(TRUE); } } @@ -2134,14 +2134,14 @@ function node_modules_disabled($modules) { // check whether a hook implementation function exists and do not invoke it. // Node access also needs to be rebuilt if language module is disabled to // remove any language-specific grants. - if (!node_access_needs_rebuild() && (Drupal::moduleHandler()->implementsHook($module, 'node_grants') || $module == 'language')) { + if (!node_access_needs_rebuild() && (\Drupal::moduleHandler()->implementsHook($module, 'node_grants') || $module == 'language')) { node_access_needs_rebuild(TRUE); } } // If there remains no more node_access module, rebuilding will be // straightforward, we can do it right now. - if (node_access_needs_rebuild() && count(Drupal::moduleHandler()->getImplementations('node_grants')) == 0) { + if (node_access_needs_rebuild() && count(\Drupal::moduleHandler()->getImplementations('node_grants')) == 0) { node_access_rebuild(); } } @@ -2172,7 +2172,7 @@ function node_language_delete($language) { function node_library_info() { $libraries['drupal.node'] = array( 'title' => 'Node', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'node') . '/node.js' => array(), ), @@ -2185,7 +2185,7 @@ function node_library_info() { ); $libraries['drupal.node.preview'] = array( 'title' => 'Node preview', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'node') . '/node.preview.js' => array(), ), @@ -2196,7 +2196,7 @@ function node_library_info() { ); $libraries['drupal.content_types'] = array( 'title' => 'Content types', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'node') . '/content_types.js' => array(), ), @@ -2222,7 +2222,7 @@ function node_library_info() { */ function node_system_info_alter(&$info, $file, $type) { if ($type == 'module' && $file->name == 'translation') { - $info['hidden'] = !module_exists('translation') && Drupal::config('system.module.disabled')->get('translation') === NULL; + $info['hidden'] = !module_exists('translation') && \Drupal::config('system.module.disabled')->get('translation') === NULL; } } @@ -2233,7 +2233,7 @@ function node_system_info_alter(&$info, $file, $type) { * The node ID. */ function node_reindex_node_search($nid) { - if (Drupal::moduleHandler()->moduleExists('search')) { + if (\Drupal::moduleHandler()->moduleExists('search')) { // Reindex node context indexed by the node module search plugin. search_mark_for_reindex('node_search', $nid); } diff --git a/core/modules/node/node.pages.inc b/core/modules/node/node.pages.inc index d80898e..1b6a1e5 100644 --- a/core/modules/node/node.pages.inc +++ b/core/modules/node/node.pages.inc @@ -93,7 +93,7 @@ function node_add($node_type) { 'langcode' => $langcode ? $langcode : language_default()->id, )); drupal_set_title(t('Create @name', array('@name' => $node_type->name)), PASS_THROUGH); - return Drupal::entityManager()->getForm($node); + return \Drupal::entityManager()->getForm($node); } /** diff --git a/core/modules/node/node.tokens.inc b/core/modules/node/node.tokens.inc index 397211f..298d44e 100644 --- a/core/modules/node/node.tokens.inc +++ b/core/modules/node/node.tokens.inc @@ -90,7 +90,7 @@ function node_token_info() { * Implements hook_tokens(). */ function node_tokens($type, $tokens, array $data = array(), array $options = array()) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $url_options = array('absolute' => TRUE); if (isset($options['langcode'])) { diff --git a/core/modules/node/node.views.inc b/core/modules/node/node.views.inc index edd8ec4..a3ad643 100644 --- a/core/modules/node/node.views.inc +++ b/core/modules/node/node.views.inc @@ -217,7 +217,7 @@ function node_views_data() { ); } - if (Drupal::moduleHandler()->moduleExists('content_translation')) { + if (\Drupal::moduleHandler()->moduleExists('content_translation')) { $data['node']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for nodes.'), diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module index abc18c6..793c595 100644 --- a/core/modules/node/tests/modules/node_access_test/node_access_test.module +++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module @@ -23,7 +23,7 @@ function node_access_test_node_grants($account, $op) { $grants['node_access_test'] = array(8888, 8889); } - $no_access_uid = Drupal::state()->get('node_access_test.no_access_uid') ?: 0; + $no_access_uid = \Drupal::state()->get('node_access_test.no_access_uid') ?: 0; if ($op == 'view' && $account->id() == $no_access_uid) { $grants['node_access_all'] = array(0); } @@ -36,7 +36,7 @@ function node_access_test_node_grants($account, $op) { function node_access_test_node_access_records(NodeInterface $node) { $grants = array(); // For NodeAccessBaseTableTestCase, only set records for private nodes. - if (!Drupal::state()->get('node_access_test.private') || $node->private->value) { + if (!\Drupal::state()->get('node_access_test.private') || $node->private->value) { $grants[] = array( 'realm' => 'node_access_test', 'gid' => 8888, @@ -97,7 +97,7 @@ function node_access_test_entity_field_info($entity_type) { */ function node_access_test_form_node_form_alter(&$form, $form_state) { // Only show this checkbox for NodeAccessBaseTableTestCase. - if (Drupal::state()->get('node_access_test.private')) { + if (\Drupal::state()->get('node_access_test.private')) { $node = $form_state['controller']->getEntity($form_state); $form['private'] = array( '#type' => 'checkbox', @@ -154,7 +154,7 @@ function _node_access_test_node_write(EntityInterface $node) { * Implements hook_node_access(). */ function node_access_test_node_access($node, $op, $account, $langcode) { - $secret_catalan = Drupal::state()->get('node_access_test_secret_catalan') ?: 0; + $secret_catalan = \Drupal::state()->get('node_access_test_secret_catalan') ?: 0; if ($secret_catalan && $langcode == 'ca') { // Make all Catalan content secret. return NODE_ACCESS_DENY; diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module index 835f82c..450f703 100644 --- a/core/modules/node/tests/modules/node_test/node_test.module +++ b/core/modules/node/tests/modules/node_test/node_test.module @@ -161,7 +161,7 @@ function node_test_node_update(EntityInterface $node) { */ function node_test_entity_view_mode_alter(&$view_mode, Drupal\Core\Entity\EntityInterface $entity, $context) { // Only alter the view mode if we are on the test callback. - $change_view_mode = Drupal::state()->get( 'node_test_change_view_mode') ?: ''; + $change_view_mode = \Drupal::state()->get( 'node_test_change_view_mode') ?: ''; if ($change_view_mode) { $view_mode = $change_view_mode; } @@ -186,7 +186,7 @@ function node_test_node_insert(EntityInterface $node) { * Implements hook_entity_info_alter(). */ function node_test_entity_info_alter(&$entity_info) { - if (Drupal::state()->get('node_test.storage_controller')) { + if (\Drupal::state()->get('node_test.storage_controller')) { $entity_info['node']['class'] = 'Drupal\node_test\NodeTest'; } } diff --git a/core/modules/options/options.module b/core/modules/options/options.module index 6dedc11..3c649c5 100644 --- a/core/modules/options/options.module +++ b/core/modules/options/options.module @@ -383,7 +383,7 @@ function options_field_update_forbid($field, $prior_field) { function _options_values_in_use($field, $values) { if ($values) { $field = field_info_field_by_id($field['uuid']); - $factory = Drupal::service('entity.query'); + $factory = \Drupal::service('entity.query'); $result = $factory->get($field->entity_type) ->condition($field['field_name'] . '.value', $values) ->count() diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module index 3788535..b6194a8 100644 --- a/core/modules/overlay/overlay.module +++ b/core/modules/overlay/overlay.module @@ -84,7 +84,7 @@ function overlay_field_extra_fields() { function overlay_form_user_form_alter(&$form, &$form_state) { $account = $form_state['controller']->getEntity(); if ($account->hasPermission('access overlay')) { - $account_data = Drupal::service('user.data')->get('overlay', $account->id(), 'enabled'); + $account_data = \Drupal::service('user.data')->get('overlay', $account->id(), 'enabled'); $form['overlay_control'] = array( '#type' => 'details', '#title' => t('Administrative overlay'), @@ -106,7 +106,7 @@ function overlay_form_user_form_alter(&$form, &$form_state) { function overlay_user_profile_form_submit($form, &$form_state) { $account = $form_state['controller']->getEntity(); if ($account->id() && isset($form_state['values']['overlay'])) { - Drupal::service('user.data')->set('overlay', $account->id(), 'enabled', (int) $form_state['values']['overlay']); + \Drupal::service('user.data')->set('overlay', $account->id(), 'enabled', (int) $form_state['values']['overlay']); } } @@ -223,7 +223,7 @@ function overlay_disable_message() { return $build; } - $user_data = Drupal::service('user.data')->get('overlay', $user->id()); + $user_data = \Drupal::service('user.data')->get('overlay', $user->id()); if (empty($user_data['message_dismissed']) && (!isset($user_data['enabled']) || $user_data['enabled'])) { $build = array( '#theme' => 'overlay_disable_message', @@ -474,14 +474,14 @@ function overlay_set_mode($mode = NULL) { drupal_add_library('overlay', 'drupal.overlay.parent'); // Allow modules to act upon overlay events. - Drupal::moduleHandler()->invokeAll('overlay_parent_initialize'); + \Drupal::moduleHandler()->invokeAll('overlay_parent_initialize'); break; case 'child': drupal_add_library('overlay', 'drupal.overlay.child'); // Allow modules to act upon overlay events. - Drupal::moduleHandler()->invokeAll('overlay_child_initialize'); + \Drupal::moduleHandler()->invokeAll('overlay_child_initialize'); break; } return $overlay_mode; @@ -494,13 +494,13 @@ function overlay_overlay_parent_initialize() { // Let the client side know which paths are administrative. $paths = path_get_admin_paths(); foreach ($paths as &$type) { - $type = str_replace('', Drupal::config('system.site')->get('page.front'), $type); + $type = str_replace('', \Drupal::config('system.site')->get('page.front'), $type); } drupal_add_js(array('overlay' => array('paths' => $paths)), 'setting'); $path_prefixes = array(); if (module_exists('language')) { language_negotiation_include(); - if (Drupal::config('language.negotiation')->get('url.source') == LANGUAGE_NEGOTIATION_URL_PREFIX) { + if (\Drupal::config('language.negotiation')->get('url.source') == LANGUAGE_NEGOTIATION_URL_PREFIX) { // Skip the empty string indicating the default language. We always accept // paths without a prefix. $path_prefixes = language_negotiation_url_prefixes(); @@ -527,8 +527,8 @@ function overlay_overlay_child_initialize() { // at the end of the page request. This allows us to check if anything // actually did change, and, if so, trigger an immediate Ajax refresh // of the parent window. - $token = Drupal::request()->query->get('token'); - $post = Drupal::request()->request->count(); + $token = \Drupal::request()->query->get('token'); + $post = \Drupal::request()->request->count(); if (!empty($post) || isset($token)) { foreach (overlay_supplemental_regions() as $region) { overlay_store_rendered_content($region, overlay_render_region($region)); diff --git a/core/modules/path/path.admin.inc b/core/modules/path/path.admin.inc index b03f8d6..200dbed 100644 --- a/core/modules/path/path.admin.inc +++ b/core/modules/path/path.admin.inc @@ -77,7 +77,7 @@ function path_admin_overview($keys = NULL) { // If the system path maps to a different URL alias, highlight this table // row to let the user know of old aliases. - if ($data->alias != Drupal::service('path.alias_manager')->getPathAlias($data->source, $data->langcode)) { + if ($data->alias != \Drupal::service('path.alias_manager')->getPathAlias($data->source, $data->langcode)) { $row['class'] = array('warning'); } @@ -204,7 +204,7 @@ function path_admin_form($form, &$form_state, $path = array('source' => '', 'ali */ function path_admin_form_delete_submit($form, &$form_state) { $destination = array(); - $query = Drupal::request()->query; + $query = \Drupal::request()->query; if ($query->has('destination')) { $destination = drupal_get_destination(); $query->remove('destination'); @@ -220,7 +220,7 @@ function path_admin_form_delete_submit($form, &$form_state) { */ function path_admin_form_validate($form, &$form_state) { $source = &$form_state['values']['source']; - $source = Drupal::service('path.alias_manager')->getSystemPath($source); + $source = \Drupal::service('path.alias_manager')->getSystemPath($source); $alias = $form_state['values']['alias']; $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0; // Language is only set if language.module is enabled, otherwise save for all @@ -254,13 +254,13 @@ function path_admin_form_submit($form, &$form_state) { $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0; $source = &$form_state['values']['source']; - $source = Drupal::service('path.alias_manager')->getSystemPath($source); + $source = \Drupal::service('path.alias_manager')->getSystemPath($source); $alias = $form_state['values']['alias']; // Language is only set if language.module is enabled, otherwise save for all // languages. $langcode = isset($form_state['values']['langcode']) ? $form_state['values']['langcode'] : Language::LANGCODE_NOT_SPECIFIED; - Drupal::service('path.crud')->save($source, $alias, $langcode, $pid); + \Drupal::service('path.crud')->save($source, $alias, $langcode, $pid); drupal_set_message(t('The alias has been saved.')); $form_state['redirect'] = 'admin/config/search/path'; diff --git a/core/modules/path/path.module b/core/modules/path/path.module index a6d7fbd..c65afd7 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -102,7 +102,7 @@ function path_form_node_form_alter(&$form, $form_state) { if ($node->language()->id != Language::LANGCODE_NOT_SPECIFIED) { $conditions['langcode'] = $node->language()->id; } - $path = Drupal::service('path.crud')->load($conditions); + $path = \Drupal::service('path.crud')->load($conditions); if ($path === FALSE) { $path = array(); } @@ -114,7 +114,7 @@ function path_form_node_form_alter(&$form, $form_state) { 'langcode' => $node->language()->id, ); - $account = Drupal::currentUser(); + $account = \Drupal::currentUser(); $form['path'] = array( '#type' => 'details', '#title' => t('URL path settings'), @@ -184,11 +184,11 @@ function path_form_element_validate($element, &$form_state, $complete_form) { * Implements hook_form_FORM_ID_alter() for taxonomy_term_form(). */ function path_form_taxonomy_term_form_alter(&$form, $form_state) { - $account = Drupal::currentUser(); + $account = \Drupal::currentUser(); // Make sure this does not show up on the delete confirmation form. if (empty($form_state['confirm_delete'])) { $term = $form_state['controller']->getEntity(); - $path = ($term->id() ? Drupal::service('path.crud')->load(array('source' => 'taxonomy/term/' . $term->id())) : array()); + $path = ($term->id() ? \Drupal::service('path.crud')->load(array('source' => 'taxonomy/term/' . $term->id())) : array()); if ($path === FALSE) { $path = array(); } @@ -245,7 +245,7 @@ function path_entity_insert(EntityInterface $entity) { // Ensure fields for programmatic executions. $uri = $entity->uri(); $langcode = $entity->language()->id; - Drupal::service('path.crud')->save($uri['path'], $entity->path->alias, $langcode); + \Drupal::service('path.crud')->save($uri['path'], $entity->path->alias, $langcode); } } } @@ -258,7 +258,7 @@ function path_entity_update(EntityInterface $entity) { $entity->path->alias = trim($entity->path->alias); // Delete old alias if user erased it. if ($entity->path->pid && !$entity->path->alias) { - Drupal::service('path.crud')->delete(array('pid' => $entity->path->pid)); + \Drupal::service('path.crud')->delete(array('pid' => $entity->path->pid)); } // Only save a non-empty alias. if ($entity->path->alias) { @@ -266,7 +266,7 @@ function path_entity_update(EntityInterface $entity) { // Ensure fields for programmatic executions. $uri = $entity->uri(); $langcode = $entity->language()->id; - Drupal::service('path.crud')->save($uri['path'], $entity->path->alias, $langcode, $pid); + \Drupal::service('path.crud')->save($uri['path'], $entity->path->alias, $langcode, $pid); } } } @@ -278,7 +278,7 @@ function path_entity_predelete(EntityInterface $entity) { if ($entity->getPropertyDefinition('path')) { // Delete all aliases associated with this term. $uri = $entity->uri(); - Drupal::service('path.crud')->delete(array('source' => $uri['path'])); + \Drupal::service('path.crud')->delete(array('source' => $uri['path'])); } } @@ -288,7 +288,7 @@ function path_entity_predelete(EntityInterface $entity) { function path_library_info() { $libraries['drupal.path'] = array( 'title' => 'Path', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'path') . '/path.js' => array(), ), diff --git a/core/modules/picture/picture.module b/core/modules/picture/picture.module index d2474d1..bdf1987 100644 --- a/core/modules/picture/picture.module +++ b/core/modules/picture/picture.module @@ -87,7 +87,7 @@ function picture_library_info() { $libraries['picturefill'] = array( 'title' => t('Picturefill'), 'website' => 'http://drupal.org/node/1775530', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'picture') . '/picturefill/picturefill.js' => array('type' => 'file', 'weight' => -10, 'group' => JS_DEFAULT), ), diff --git a/core/modules/rdf/rdf.install b/core/modules/rdf/rdf.install index 117c910..bc984f5 100644 --- a/core/modules/rdf/rdf.install +++ b/core/modules/rdf/rdf.install @@ -23,7 +23,7 @@ function rdf_update_8000() { $bundle = $row['bundle']; // Create a config object for the mapping. - $config = Drupal::config("rdf.mapping.$entity_type.$bundle") + $config = \Drupal::config("rdf.mapping.$entity_type.$bundle") ->set('id', "$entity_type.$bundle") ->set('uuid', $uuid->generate()) ->set('targetEntityType', $entity_type) diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index 428f16b..9708694 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -110,7 +110,7 @@ function rdf_get_namespaces() { $namespaces = array(); // In order to resolve duplicate namespaces by using the earliest defined // namespace, do not use \Drupal::moduleHandler()->invokeAll(). - foreach (Drupal::moduleHandler()->getImplementations('rdf_namespaces') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('rdf_namespaces') as $module) { $function = $module . '_rdf_namespaces'; if (function_exists($function)) { $namespaces = NestedArray::mergeDeep($function(), $namespaces); diff --git a/core/modules/rest/rest.module b/core/modules/rest/rest.module index a37bfe7..086961a 100644 --- a/core/modules/rest/rest.module +++ b/core/modules/rest/rest.module @@ -10,8 +10,8 @@ */ function rest_permission() { $permissions = array(); - $manager = Drupal::service('plugin.manager.rest'); - $resources = Drupal::config('rest.settings')->get('resources'); + $manager = \Drupal::service('plugin.manager.rest'); + $resources = \Drupal::config('rest.settings')->get('resources'); if ($resources && $enabled = array_intersect_key($manager->getDefinitions(), $resources)) { foreach ($enabled as $key => $resource) { $plugin = $manager->getInstance(array('id' => $key)); diff --git a/core/modules/search/search.module b/core/modules/search/search.module index a4830ad..9464279 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -179,7 +179,7 @@ function search_menu() { $default_info = search_get_default_plugin_info(); if ($default_info) { - foreach (Drupal::service('plugin.manager.search')->getActiveDefinitions() as $plugin_id => $search_info) { + foreach (\Drupal::service('plugin.manager.search')->getActiveDefinitions() as $plugin_id => $search_info) { $path = 'search/' . $search_info['path']; $items[$path] = array( 'title' => $search_info['title'], @@ -218,8 +218,8 @@ function search_menu() { */ function search_is_active() { // This path cannot be accessed if there are no active plugins. - $account = Drupal::request()->attributes->get('_account'); - return !empty($account) && $account->hasPermission('search content') && Drupal::service('plugin.manager.search')->getActiveDefinitions(); + $account = \Drupal::request()->attributes->get('_account'); + return !empty($account) && $account->hasPermission('search content') && \Drupal::service('plugin.manager.search')->getActiveDefinitions(); } /** @@ -229,8 +229,8 @@ function search_is_active() { * The search plugin definition for the default search plugin, if any. */ function search_get_default_plugin_info() { - $info = Drupal::service('plugin.manager.search')->getActiveDefinitions(); - $default = Drupal::config('search.settings')->get('default_plugin'); + $info = \Drupal::service('plugin.manager.search')->getActiveDefinitions(); + $default = \Drupal::config('search.settings')->get('default_plugin'); if (isset($info[$default])) { return $info[$default]; } @@ -251,12 +251,12 @@ function search_get_default_plugin_info() { * @see search_menu() */ function _search_menu_access($plugin_id) { - $account = Drupal::request()->attributes->get('_account'); + $account = \Drupal::request()->attributes->get('_account'); // @todo - remove the empty() check once we are more confident // that the account will be populated, especially during tests. // @see https://drupal.org/node/2032553 $access = !empty($account) && $account->hasPermission('search content'); - return $access && Drupal::service('plugin.manager.search')->pluginAccess($plugin_id, $account); + return $access && \Drupal::service('plugin.manager.search')->pluginAccess($plugin_id, $account); } /** @@ -277,7 +277,7 @@ function _search_menu_access($plugin_id) { */ function search_reindex($sid = NULL, $type = NULL, $reindex = FALSE, $langcode = NULL) { if ($type == NULL && $sid == NULL) { - foreach (Drupal::service('plugin.manager.search')->getActiveIndexingPlugins() as $plugin) { + foreach (\Drupal::service('plugin.manager.search')->getActiveIndexingPlugins() as $plugin) { $plugin->resetIndex(); } } @@ -328,7 +328,7 @@ function search_cron() { // to date. drupal_register_shutdown_function('search_update_totals'); - foreach (Drupal::service('plugin.manager.search')->getActiveIndexingPlugins() as $plugin) { + foreach (\Drupal::service('plugin.manager.search')->getActiveIndexingPlugins() as $plugin) { $plugin->updateIndex(); } } @@ -388,7 +388,7 @@ function search_simplify($text, $langcode = NULL) { search_invoke_preprocess($text, $langcode); // Simple CJK handling - if (Drupal::config('search.settings')->get('index.overlap_cjk')) { + if (\Drupal::config('search.settings')->get('index.overlap_cjk')) { $text = preg_replace_callback('/[' . PREG_CLASS_CJK . ']+/u', 'search_expand_cjk', $text); } @@ -442,7 +442,7 @@ function search_simplify($text, $langcode = NULL) { * Tokenized text, starting and ending with a space character. */ function search_expand_cjk($matches) { - $min = Drupal::config('search.settings')->get('index.minimum_word_size'); + $min = \Drupal::config('search.settings')->get('index.minimum_word_size'); $str = $matches[0]; $length = drupal_strlen($str); // If the text is shorter than the minimum word size, don't tokenize it. @@ -502,7 +502,7 @@ function _search_index_truncate(&$text) { * Invokes hook_search_preprocess() in modules. */ function search_invoke_preprocess(&$text, $langcode = NULL) { - foreach (Drupal::moduleHandler()->getImplementations('search_preprocess') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('search_preprocess') as $module) { $text = module_invoke($module, 'search_preprocess', $text, $langcode); } } @@ -522,12 +522,12 @@ function search_invoke_preprocess(&$text, $langcode = NULL) { * @ingroup search */ function search_index($sid, $type, $text, $langcode) { - $minimum_word_size = Drupal::config('search.settings')->get('index.minimum_word_size'); + $minimum_word_size = \Drupal::config('search.settings')->get('index.minimum_word_size'); // Multipliers for scores of words inside certain HTML tags. The weights are // stored in config so that modules can overwrite the default weights. // Note: 'a' must be included for link ranking to work. - $tags = Drupal::config('search.settings')->get('index.tag_weights'); + $tags = \Drupal::config('search.settings')->get('index.tag_weights'); // Strip off all ignored tags to speed up processing, but insert space before // and after them to keep word boundaries. diff --git a/core/modules/search/search.pages.inc b/core/modules/search/search.pages.inc index 804e4be..b9e06ab 100644 --- a/core/modules/search/search.pages.inc +++ b/core/modules/search/search.pages.inc @@ -25,7 +25,7 @@ function search_view($plugin_id = NULL, $keys = '') { $keys = trim($_REQUEST['keys']); } - $manager = Drupal::service('plugin.manager.search'); + $manager = \Drupal::service('plugin.manager.search'); if (!empty($plugin_id)) { $active_plugin_info = $manager->getActiveDefinitions(); if (isset($active_plugin_info[$plugin_id])) { @@ -46,7 +46,7 @@ function search_view($plugin_id = NULL, $keys = '') { return new RedirectResponse(url($path, array('absolute' => TRUE))); } $plugin = $manager->createInstance($plugin_id); - $request = Drupal::request(); + $request = \Drupal::request(); $plugin->setSearch($keys, $request->query->all(), $request->attributes->all()); // Default results output is an empty string. $results = array('#markup' => ''); diff --git a/core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module b/core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module index d59f184..680322a 100644 --- a/core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module +++ b/core/modules/search/tests/modules/search_embedded_form/search_embedded_form.module @@ -30,7 +30,7 @@ function search_embedded_form_menu() { * @see search_embedded_form_form_submit(). */ function search_embedded_form_form($form, &$form_state) { - $count = Drupal::config('search_embedded_form.settings')->get('submitted'); + $count = \Drupal::config('search_embedded_form.settings')->get('submitted'); $form['name'] = array( '#type' => 'textfield', @@ -56,7 +56,7 @@ function search_embedded_form_form($form, &$form_state) { * Submit handler for search_embedded_form_form(). */ function search_embedded_form_form_submit($form, &$form_state) { - $config = Drupal::config('search_embedded_form.settings'); + $config = \Drupal::config('search_embedded_form.settings'); $submit_count = (int) $config->get('submitted'); $config->set('submitted', $submit_count + 1)->save(); drupal_set_message(t('Test form was submitted')); diff --git a/core/modules/shortcut/shortcut.admin.inc b/core/modules/shortcut/shortcut.admin.inc index c230fb5..523fead 100644 --- a/core/modules/shortcut/shortcut.admin.inc +++ b/core/modules/shortcut/shortcut.admin.inc @@ -27,7 +27,7 @@ * @see shortcut_set_switch_submit() */ function shortcut_set_switch($form, &$form_state, $account = NULL) { - $user = Drupal::currentUser(); + $user = \Drupal::currentUser(); if (!isset($account)) { $account = $user; @@ -244,7 +244,7 @@ function _shortcut_link_form_elements($shortcut_link = NULL) { )); } else { - $shortcut_link['link_path'] = ($shortcut_link['link_path'] == '') ? '' : Drupal::service('path.alias_manager')->getPathAlias($shortcut_link['link_path']); + $shortcut_link['link_path'] = ($shortcut_link['link_path'] == '') ? '' : \Drupal::service('path.alias_manager')->getPathAlias($shortcut_link['link_path']); } $form['shortcut_link']['#tree'] = TRUE; @@ -291,7 +291,7 @@ function shortcut_link_edit_validate($form, &$form_state) { */ function shortcut_link_edit_submit($form, &$form_state) { // Normalize the path in case it is an alias. - $shortcut_path = Drupal::service('path.alias_manager')->getSystemPath($form_state['values']['shortcut_link']['link_path']); + $shortcut_path = \Drupal::service('path.alias_manager')->getSystemPath($form_state['values']['shortcut_link']['link_path']); if (empty($shortcut_path)) { $shortcut_path = ''; } @@ -335,7 +335,7 @@ function shortcut_link_add_submit($form, &$form_state) { */ function shortcut_admin_add_link($shortcut_link, &$shortcut_set) { // Normalize the path in case it is an alias. - $shortcut_link['link_path'] = Drupal::service('path.alias_manager')->getSystemPath($shortcut_link['link_path']); + $shortcut_link['link_path'] = \Drupal::service('path.alias_manager')->getSystemPath($shortcut_link['link_path']); if (empty($shortcut_link['link_path'])) { $shortcut_link['link_path'] = ''; } diff --git a/core/modules/shortcut/shortcut.api.php b/core/modules/shortcut/shortcut.api.php index 27eecf3..fa93e96 100644 --- a/core/modules/shortcut/shortcut.api.php +++ b/core/modules/shortcut/shortcut.api.php @@ -32,7 +32,7 @@ */ function hook_shortcut_default_set($account) { // Use a special set of default shortcuts for administrators only. - if (in_array(Drupal::config('user.settings')->get('admin_role'), $account->getRoles())) { + if (in_array(\Drupal::config('user.settings')->get('admin_role'), $account->getRoles())) { return 'admin-shortcuts'; } } diff --git a/core/modules/shortcut/shortcut.install b/core/modules/shortcut/shortcut.install index 76e7097..6c098a3 100644 --- a/core/modules/shortcut/shortcut.install +++ b/core/modules/shortcut/shortcut.install @@ -84,7 +84,7 @@ function shortcut_update_8000() { ->condition('menu_name', 'shortcut-set-1') ->execute(); } - Drupal::config('shortcut.set.' . $set->set_name) + \Drupal::config('shortcut.set.' . $set->set_name) ->set('id', $set->set_name) ->set('label', $set->title) ->set('uuid', $uuid->generate()) diff --git a/core/modules/shortcut/shortcut.module b/core/modules/shortcut/shortcut.module index 1d1a505..78d9f1c 100644 --- a/core/modules/shortcut/shortcut.module +++ b/core/modules/shortcut/shortcut.module @@ -12,7 +12,7 @@ * Implements hook_help(). */ function shortcut_help($path, $arg) { - $user = Drupal::currentUser(); + $user = \Drupal::currentUser(); switch ($path) { case 'admin/help#shortcut': @@ -171,7 +171,7 @@ function shortcut_admin_paths() { * otherwise. */ function shortcut_set_edit_access($shortcut_set = NULL) { - $account = Drupal::currentUser(); + $account = \Drupal::currentUser(); // Sufficiently-privileged users can edit their currently displayed shortcut // set, but not other sets. Shortcut administrators can edit any set. if ($account->hasPermission('administer shortcuts')) { @@ -196,7 +196,7 @@ function shortcut_set_edit_access($shortcut_set = NULL) { * provided account, FALSE otherwise. */ function shortcut_set_switch_access($account = NULL) { - $user = Drupal::currentUser(); + $user = \Drupal::currentUser(); if ($user->hasPermission('administer shortcuts')) { // Administrators can switch anyone's shortcut set. @@ -286,7 +286,7 @@ function shortcut_set_reset_link_weights(&$shortcut_set) { * A user account that will be assigned to use the set. */ function shortcut_set_assign_user($shortcut_set, $account) { - Drupal::entityManager() + \Drupal::entityManager() ->getStorageController('shortcut_set') ->assignUser($shortcut_set, $account); } @@ -305,7 +305,7 @@ function shortcut_set_assign_user($shortcut_set, $account) { * to any set. */ function shortcut_set_unassign_user($account) { - return (bool) Drupal::entityManager() + return (bool) \Drupal::entityManager() ->getStorageController('shortcut_set') ->unassignUser($account); } @@ -334,7 +334,7 @@ function shortcut_current_displayed_set($account = NULL) { } // If none was found, try to find a shortcut set that is explicitly assigned // to this user. - $shortcut_set_name = Drupal::entityManager() + $shortcut_set_name = \Drupal::entityManager() ->getStorageController('shortcut_set') ->getAssignedToUser($account); if ($shortcut_set_name) { @@ -370,7 +370,7 @@ function shortcut_default_set($account = NULL) { // have one, we allow the last module which returns a valid result to take // precedence. If no module returns a valid set, fall back on the site-wide // default, which is the lowest-numbered shortcut set. - $suggestions = array_reverse(Drupal::moduleHandler()->invokeAll('shortcut_default_set', array($account))); + $suggestions = array_reverse(\Drupal::moduleHandler()->invokeAll('shortcut_default_set', array($account))); $suggestions[] = 'default'; foreach ($suggestions as $name) { if ($shortcut_set = shortcut_set_load($name)) { @@ -414,13 +414,13 @@ function shortcut_set_title_exists($title) { */ function shortcut_valid_link($path) { // Do not use URL aliases. - $normal_path = Drupal::service('path.alias_manager')->getSystemPath($path); + $normal_path = \Drupal::service('path.alias_manager')->getSystemPath($path); if ($path != $normal_path) { $path = $normal_path; } // An empty path is valid too and will be converted to . - return (!url_is_external($path) && (Drupal::service('router.route_provider')->getRoutesByPattern('/' . $path)->count() > 0 || menu_get_item($path))) || empty($path) || $path == ''; + return (!url_is_external($path) && (\Drupal::service('router.route_provider')->getRoutesByPattern('/' . $path)->count() > 0 || menu_get_item($path))) || empty($path) || $path == ''; } /** @@ -564,7 +564,7 @@ function shortcut_library_info() { $path = drupal_get_path('module', 'shortcut'); $libraries['drupal.shortcut.admin'] = array( 'title' => 'Shortcut configuration', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/shortcut.admin.js' => array(), ), @@ -575,7 +575,7 @@ function shortcut_library_info() { ); $libraries['drupal.shortcut'] = array( 'title' => 'Shortcut UI', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'css' => array( $path . '/css/shortcut.module.css' => array(), $path . '/css/shortcut.theme.css' => array(), diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index c0a9102..a8d4709 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -991,7 +991,7 @@ protected function prepareConfigDirectories() { } /** - * Rebuild Drupal::getContainer(). + * Rebuild \Drupal::getContainer(). * * Use this to build a new kernel and service container. For example, when the * list of enabled modules is changed via the internal browser, in which case @@ -1002,14 +1002,14 @@ protected function prepareConfigDirectories() { * @see TestBase::tearDown() * * @todo Fix http://drupal.org/node/1708692 so that module enable/disable - * changes are immediately reflected in Drupal::getContainer(). Until then, + * changes are immediately reflected in \Drupal::getContainer(). Until then, * tests can invoke this workaround when requiring services from newly * enabled modules to be immediately available in the same request. */ protected function rebuildContainer() { $this->kernel = new DrupalKernel('testing', drupal_classloader(), FALSE); $this->kernel->boot(); - // DrupalKernel replaces the container in Drupal::getContainer() with a + // DrupalKernel replaces the container in \Drupal::getContainer() with a // different object, so we need to replace the instance on this test class. $this->container = \Drupal::getContainer(); // The global $user is set in TestBase::prepareEnvironment(). diff --git a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php index 505ff33..318e47c 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/Tests/DrupalUnitTestBaseTest.php @@ -57,7 +57,7 @@ function testEnableModulesLoad() { $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'); - $this->assertFalse(in_array($module, $list), "{$module}_permission() in Drupal::moduleHandler()->getImplementations() not found."); + $this->assertFalse(in_array($module, $list), "{$module}_permission() in \Drupal::moduleHandler()->getImplementations() not found."); // Enable the module. $this->enableModules(array($module)); @@ -67,7 +67,7 @@ function testEnableModulesLoad() { $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'); - $this->assertTrue(in_array($module, $list), "{$module}_permission() in Drupal::moduleHandler()->getImplementations() found."); + $this->assertTrue(in_array($module, $list), "{$module}_permission() in \Drupal::moduleHandler()->getImplementations() found."); } /** @@ -82,7 +82,7 @@ function testEnableModulesInstall() { $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'); - $this->assertFalse(in_array($module, $list), "{$module}_permission() in Drupal::moduleHandler()->getImplementations() not found."); + $this->assertFalse(in_array($module, $list), "{$module}_permission() in \Drupal::moduleHandler()->getImplementations() not found."); $this->assertFalse(db_table_exists($table), "'$table' database table not found."); $schema = drupal_get_schema($table); @@ -96,7 +96,7 @@ function testEnableModulesInstall() { $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'); - $this->assertTrue(in_array($module, $list), "{$module}_permission() in Drupal::moduleHandler()->getImplementations() found."); + $this->assertTrue(in_array($module, $list), "{$module}_permission() in \Drupal::moduleHandler()->getImplementations() found."); $this->assertTrue(db_table_exists($table), "'$table' database table found."); $schema = drupal_get_schema($table); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php index dd725ed..350fa51 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php @@ -15,7 +15,7 @@ * * These tests can not access the database nor files. Calling any Drupal * function that needs the database will throw exceptions. These include - * watchdog(), Drupal::moduleHandler()->getImplementations(), module_invoke_all() etc. + * watchdog(), \Drupal::moduleHandler()->getImplementations(), module_invoke_all() etc. */ abstract class UnitTestBase extends TestBase { diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 8d441f4..0553291 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -159,7 +159,7 @@ function simpletest_run_tests($test_list, $reporter = 'drupal') { ); batch_set($batch); - Drupal::moduleHandler()->invokeAll('test_group_started'); + \Drupal::moduleHandler()->invokeAll('test_group_started'); return $test_id; } @@ -305,7 +305,7 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) { $size = count($test_list); $info = $test->getInfo(); - Drupal::moduleHandler()->invokeAll('test_finished', array($test->results)); + \Drupal::moduleHandler()->invokeAll('test_finished', array($test->results)); // Gather results and compose the report. $test_results[$test_class] = $test->results; @@ -352,7 +352,7 @@ function _simpletest_batch_finished($success, $results, $operations, $elapsed) { drupal_set_message(t('The test run did not successfully finish.'), 'error'); drupal_set_message(t('Use the Clean environment button to clean-up temporary files and tables.'), 'warning'); } - Drupal::moduleHandler()->invokeAll('test_group_finished'); + \Drupal::moduleHandler()->invokeAll('test_group_finished'); } /** @@ -573,7 +573,7 @@ function simpletest_generate_file($filename, $width, $lines, $type = 'binary-tex function simpletest_clean_environment() { simpletest_clean_database(); simpletest_clean_temporary_directories(); - if (Drupal::config('simpletest.settings')->get('clear_results')) { + if (\Drupal::config('simpletest.settings')->get('clear_results')) { $count = simpletest_clean_results_table(); drupal_set_message(format_plural($count, 'Removed 1 test result.', 'Removed @count test results.')); } @@ -643,7 +643,7 @@ function simpletest_clean_temporary_directories() { * The number of results removed. */ function simpletest_clean_results_table($test_id = NULL) { - if (Drupal::config('simpletest.settings')->get('clear_results')) { + if (\Drupal::config('simpletest.settings')->get('clear_results')) { if ($test_id) { $count = db_query('SELECT COUNT(test_id) FROM {simpletest_test_id} WHERE test_id = :test_id', array(':test_id' => $test_id))->fetchField(); @@ -686,7 +686,7 @@ function simpletest_mail_alter(&$message) { function simpletest_library_info() { $libraries['drupal.simpletest'] = array( 'title' => 'Simpletest', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'simpletest') . '/simpletest.js' => array(), ), diff --git a/core/modules/statistics/statistics.install b/core/modules/statistics/statistics.install index 5706db3..9b443e5 100644 --- a/core/modules/statistics/statistics.install +++ b/core/modules/statistics/statistics.install @@ -10,8 +10,8 @@ */ function statistics_uninstall() { // Remove states. - Drupal::state()->delete('statistics.node_counter_scale'); - Drupal::state()->delete('statistics.day_timestamp'); + \Drupal::state()->delete('statistics.node_counter_scale'); + \Drupal::state()->delete('statistics.day_timestamp'); } /** diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index 853d139..5b11a09 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -90,14 +90,14 @@ function statistics_menu() { * Implements hook_cron(). */ function statistics_cron() { - $statistics_timestamp = Drupal::state()->get('statistics.day_timestamp') ?: 0; + $statistics_timestamp = \Drupal::state()->get('statistics.day_timestamp') ?: 0; if ((REQUEST_TIME - $statistics_timestamp) >= 86400) { // Reset day counts. db_update('node_counter') ->fields(array('daycount' => 0)) ->execute(); - Drupal::state()->set('statistics.day_timestamp', REQUEST_TIME); + \Drupal::state()->set('statistics.day_timestamp', REQUEST_TIME); } } @@ -174,7 +174,7 @@ function statistics_get($nid) { * A string as a link, truncated to the width, linked to the given $path. */ function _statistics_link($path, $width = 35) { - $title = Drupal::service('path.alias_manager')->getPathAlias($path); + $title = \Drupal::service('path.alias_manager')->getPathAlias($path); $title = truncate_utf8($title, $width, FALSE, TRUE); return l($title, $path); } @@ -211,7 +211,7 @@ function statistics_node_predelete(EntityInterface $node) { * Implements hook_ranking(). */ function statistics_ranking() { - if (Drupal::config('statistics.settings')->get('count_content_views')) { + if (\Drupal::config('statistics.settings')->get('count_content_views')) { return array( 'views' => array( 'title' => t('Number of views'), @@ -223,7 +223,7 @@ function statistics_ranking() { ), // Inverse law that maps the highest view count on the site to 1 and 0 to 0. 'score' => '2.0 - 2.0 / (1.0 + node_counter.totalcount * CAST(:scale AS DECIMAL))', - 'arguments' => array(':scale' => Drupal::state()->get('statistics.node_counter_scale') ?: 0), + 'arguments' => array(':scale' => \Drupal::state()->get('statistics.node_counter_scale') ?: 0), ), ); } @@ -233,7 +233,7 @@ function statistics_ranking() { * Implements hook_update_index(). */ function statistics_update_index() { - Drupal::state()->set('statistics.node_counter_scale', 1.0 / max(1, db_query('SELECT MAX(totalcount) FROM {node_counter}')->fetchField())); + \Drupal::state()->set('statistics.node_counter_scale', 1.0 / max(1, db_query('SELECT MAX(totalcount) FROM {node_counter}')->fetchField())); } /** @@ -251,7 +251,7 @@ function statistics_preprocess_block(&$variables) { function statistics_library_info() { $libraries['drupal.statistics'] = array( 'title' => 'Statistics', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'statistics') . '/statistics.js' => array( 'scope' => 'footer' @@ -274,7 +274,7 @@ function statistics_library_info() { * to count content views. */ function statistics_block_alter(&$definitions) { - $statistics_count_content_views = Drupal::config('statistics.settings')->get('count_content_views'); + $statistics_count_content_views = \Drupal::config('statistics.settings')->get('count_content_views'); if (empty($statistics_count_content_views)) { unset($definitions['statistics_popular_block']); } diff --git a/core/modules/statistics/statistics.tokens.inc b/core/modules/statistics/statistics.tokens.inc index 02de3a0..d2be86c 100644 --- a/core/modules/statistics/statistics.tokens.inc +++ b/core/modules/statistics/statistics.tokens.inc @@ -32,7 +32,7 @@ function statistics_token_info() { * Implements hook_tokens(). */ function statistics_tokens($type, $tokens, array $data = array(), array $options = array()) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $replacements = array(); diff --git a/core/modules/syslog/syslog.install b/core/modules/syslog/syslog.install index c9eb769..c36feeb 100644 --- a/core/modules/syslog/syslog.install +++ b/core/modules/syslog/syslog.install @@ -11,7 +11,7 @@ function syslog_install() { // The default facility setting depends on the operating system, so it needs // to be set dynamically during installation. - Drupal::config('syslog.settings')->set('facility', defined('LOG_LOCAL0') ? LOG_LOCAL0 : LOG_USER)->save(); + \Drupal::config('syslog.settings')->set('facility', defined('LOG_LOCAL0') ? LOG_LOCAL0 : LOG_USER)->save(); } /** diff --git a/core/modules/syslog/syslog.module b/core/modules/syslog/syslog.module index c46f58a..51c5792 100644 --- a/core/modules/syslog/syslog.module +++ b/core/modules/syslog/syslog.module @@ -45,7 +45,7 @@ function syslog_help($path, $arg) { * Implements hook_form_FORM_ID_alter(). */ function syslog_form_system_logging_settings_alter(&$form, &$form_state) { - $config = Drupal::config('syslog.settings'); + $config = \Drupal::config('syslog.settings'); $help = module_exists('help') ? ' ' . l(t('More information'), 'admin/help/syslog') . '.' : NULL; $form['syslog_identity'] = array( '#type' => 'textfield', @@ -78,7 +78,7 @@ function syslog_form_system_logging_settings_alter(&$form, &$form_state) { * @see syslog_form_system_logging_settings_alter() */ function syslog_logging_settings_submit($form, &$form_state) { - Drupal::config('syslog.settings') + \Drupal::config('syslog.settings') ->set('identity', $form_state['values']['syslog_identity']) ->set('facility', $form_state['values']['syslog_facility']) ->set('format', $form_state['values']['syslog_format']) @@ -111,7 +111,7 @@ function syslog_watchdog(array $log_entry) { global $base_url; $log_init = &drupal_static(__FUNCTION__, FALSE); - $config = Drupal::config('syslog.settings'); + $config = \Drupal::config('syslog.settings'); if (!$log_init) { $log_init = TRUE; diff --git a/core/modules/system/language.api.php b/core/modules/system/language.api.php index 2e8d91f..cfa42ec 100644 --- a/core/modules/system/language.api.php +++ b/core/modules/system/language.api.php @@ -199,7 +199,7 @@ function hook_language_fallback_candidates_alter(array &$fallback_candidates) { * // Use the current default interface language. * $langcode = language(\Drupal\Core\Language\Language::TYPE_INTERFACE)->id; * // Instantiate the transliteration class. - * $trans = Drupal::transliteration(); + * $trans = \Drupal::transliteration(); * // Use this to transliterate some text. * $transformed = $trans->transliterate($string, $langcode); * @endcode diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php index 4f650bf..3487fd4 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/UrlTest.php @@ -14,7 +14,7 @@ /** * Tests for URL generation functions. * - * url() calls Drupal::moduleHandler()->getImplementations(), + * url() calls \Drupal::moduleHandler()->getImplementations(), * which may issue a db query, which requires * inheriting from a web test case rather than a unit test case. */ 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 8ca5379..d6362b5 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php @@ -81,7 +81,7 @@ protected function assertModuleList(Array $expected_values, $condition) { } /** - * Test Drupal::moduleHandler()->getImplementations() caching. + * Test \Drupal::moduleHandler()->getImplementations() caching. */ function testModuleImplements() { // Clear the cache. diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index cefffd1..5f6d62f 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -18,9 +18,9 @@ function system_themes_page() { $themes = system_rebuild_theme_data(); uasort($themes, 'system_sort_modules_by_info_name'); - $theme_default = Drupal::config('system.theme')->get('default'); + $theme_default = \Drupal::config('system.theme')->get('default'); $theme_groups = array(); - $admin_theme = Drupal::config('system.theme')->get('admin'); + $admin_theme = \Drupal::config('system.theme')->get('admin'); foreach ($themes as &$theme) { if (!empty($theme->info['hidden'])) { @@ -55,7 +55,7 @@ function system_themes_page() { // Ensure this theme is compatible with this version of core. // Require the 'content' region to make sure the main page // content has a common place in all themes. - $theme->incompatible_core = !isset($theme->info['core']) || ($theme->info['core'] != Drupal::CORE_COMPATIBILITY) || (!isset($theme->info['regions']['content'])); + $theme->incompatible_core = !isset($theme->info['core']) || ($theme->info['core'] != \Drupal::CORE_COMPATIBILITY) || (!isset($theme->info['regions']['content'])); $theme->incompatible_php = version_compare(phpversion(), $theme->info['php']) < 0; // Confirmed that the base theme is available. $theme->incompatible_base = (isset($theme->info['base theme']) && !isset($themes[$theme->info['base theme']])); @@ -157,7 +157,7 @@ function system_themes_admin_form($form, &$form_state, $theme_options) { '#options' => array(0 => t('Default theme')) + $theme_options, '#title' => t('Administration theme'), '#description' => t('Choose "Default theme" to always use the same theme as the rest of the site.'), - '#default_value' => Drupal::config('system.theme')->get('admin'), + '#default_value' => \Drupal::config('system.theme')->get('admin'), ); $form['admin_theme']['actions'] = array('#type' => 'actions'); $form['admin_theme']['actions']['submit'] = array( @@ -172,14 +172,14 @@ function system_themes_admin_form($form, &$form_state, $theme_options) { */ function system_themes_admin_form_submit($form, &$form_state) { drupal_set_message(t('The configuration options have been saved.')); - Drupal::config('system.theme')->set('admin', $form_state['values']['admin_theme'])->save(); + \Drupal::config('system.theme')->set('admin', $form_state['values']['admin_theme'])->save(); } /** * Menu callback; Set the default theme. */ function system_theme_default() { - $request = Drupal::request(); + $request = \Drupal::request(); $theme = $request->get('theme'); $token = $request->get('token'); if (!empty($theme) && !empty($token) && drupal_valid_token($token, 'system-theme-operation-link')) { @@ -193,7 +193,7 @@ function system_theme_default() { theme_enable(array($theme)); } // Set the default theme. - Drupal::config('system.theme') + \Drupal::config('system.theme') ->set('default', $theme) ->save(); @@ -207,7 +207,7 @@ function system_theme_default() { // The status message depends on whether an admin theme is currently in use: // a value of 0 means the admin theme is set to be the default theme. - $admin_theme = Drupal::config('system.theme')->get('admin'); + $admin_theme = \Drupal::config('system.theme')->get('admin'); if ($admin_theme != 0 && $admin_theme != $theme) { drupal_set_message(t('Please note that the administration theme is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array( '%admin_theme' => $themes[$admin_theme]->info['name'], @@ -691,7 +691,7 @@ function theme_system_themes_page($variables) { // Make sure to provide feedback on compatibility. if (!empty($theme->incompatible_core)) { - $output .= '
' . t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => Drupal::CORE_COMPATIBILITY)) . '
'; + $output .= '
' . t('This version is not compatible with Drupal !core_version and should be replaced.', array('!core_version' => \Drupal::CORE_COMPATIBILITY)) . '
'; } elseif (!empty($theme->incompatible_php)) { if (substr_count($theme->info['php'], '.') < 2) { @@ -748,8 +748,8 @@ function system_date_format_localize_form($form, &$form_state, $langcode) { ); // Get list of available formats. - $date_service = Drupal::service('date'); - $formats = Drupal::entityManager() + $date_service = \Drupal::service('date'); + $formats = \Drupal::entityManager() ->getStorageController('date_format') ->loadMultiple(); $choices = array(); @@ -849,7 +849,7 @@ function theme_system_date_format_localize_form($variables) { */ function system_date_format_localize_form_save($langcode, $date_format_id, DateFormatInterface $format) { $format->addLocale($langcode)->save(); - Drupal::config('locale.config.' . $langcode . '.system.date_format.' . $date_format_id) + \Drupal::config('locale.config.' . $langcode . '.system.date_format.' . $date_format_id) ->set('pattern', $format->get('pattern')) ->save(); } diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index d366e01..78d749d 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -125,7 +125,7 @@ function hook_cron() { ':time' => REQUEST_TIME, ':never' => AGGREGATOR_CLEAR_NEVER, )); - $queue = Drupal::queue('aggregator_feeds'); + $queue = \Drupal::queue('aggregator_feeds'); foreach ($result as $feed) { $queue->createItem($feed); } @@ -1357,14 +1357,14 @@ function hook_mail_alter(&$message) { $message['send'] = FALSE; return; } - $message['body'][] = "--\nMail sent out from " . Drupal::config('system.site')->get('name'); + $message['body'][] = "--\nMail sent out from " . \Drupal::config('system.site')->get('name'); } } /** * Alter the registry of modules implementing a hook. * - * This hook is invoked during Drupal::moduleHandler()->getImplementations(). + * This hook is invoked during \Drupal::moduleHandler()->getImplementations(). * A module may implement this hook in order to reorder the implementing * modules, which are otherwise ordered by the module's system weight. * @@ -1387,7 +1387,7 @@ function hook_mail_alter(&$message) { function hook_module_implements_alter(&$implementations, $hook) { if ($hook == 'rdf_mapping') { // Move my_module_rdf_mapping() to the end of the list. - // Drupal::moduleHandler()->getImplementations() + // \Drupal::moduleHandler()->getImplementations() // iterates through $implementations with a foreach loop which PHP iterates // in the order that the items were added, so to move an item to the end of // the array, we remove it and then add it. @@ -1717,7 +1717,7 @@ function hook_template_preprocess_default_variables_alter(&$variables) { */ function hook_custom_theme() { // Allow the user to request a particular theme via a query parameter. - return Drupal::request()->query->get('theme'); + return \Drupal::request()->query->get('theme'); } /** @@ -1775,7 +1775,7 @@ function hook_watchdog(array $log_entry) { $to = 'someone@example.com'; $params = array(); $params['subject'] = t('[@site_name] @severity_desc: Alert from your web site', array( - '@site_name' => Drupal::config('system.site')->get('name'), + '@site_name' => \Drupal::config('system.site')->get('name'), '@severity_desc' => $severity_list[$log_entry['severity']], )); @@ -1841,7 +1841,7 @@ function hook_mail($key, &$message, $params) { $account = $params['account']; $context = $params['context']; $variables = array( - '%site_name' => Drupal::config('system.site')->get('name'), + '%site_name' => \Drupal::config('system.site')->get('name'), '%username' => user_format_name($account), ); if ($context['hook'] == 'taxonomy') { @@ -2150,7 +2150,7 @@ function hook_file_download($uri) { return -1; } else { - $image = Drupal::service('image.factory')->get($uri); + $image = \Drupal::service('image.factory')->get($uri); return array('Content-Type' => $image->getMimeType()); } } @@ -2277,7 +2277,7 @@ function hook_requirements($phase) { if ($phase == 'runtime') { $requirements['drupal'] = array( 'title' => t('Drupal'), - 'value' => Drupal::VERSION, + 'value' => \Drupal::VERSION, 'severity' => REQUIREMENT_INFO ); } @@ -3119,7 +3119,7 @@ function hook_url_outbound_alter(&$path, &$options, $original_path) { * @see hook_tokens_alter() */ function hook_tokens($type, $tokens, array $data = array(), array $options = array()) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $url_options = array('absolute' => TRUE); if (isset($options['langcode'])) { diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 5222f25..fba64c9 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -22,7 +22,7 @@ function system_requirements($phase) { if ($phase == 'runtime') { $requirements['drupal'] = array( 'title' => t('Drupal'), - 'value' => Drupal::VERSION, + 'value' => \Drupal::VERSION, 'severity' => REQUIREMENT_INFO, 'weight' => -10, ); @@ -260,7 +260,7 @@ function system_requirements($phase) { // Report cron status. if ($phase == 'runtime') { - $cron_config = Drupal::config('system.cron'); + $cron_config = \Drupal::config('system.cron'); // Cron warning threshold defaults to two days. $threshold_warning = $cron_config->get('threshold.requirements_warning'); // Cron error threshold defaults to two weeks. @@ -269,7 +269,7 @@ function system_requirements($phase) { $help = t('For more information, see the online handbook entry for configuring cron jobs.', array('@cron-handbook' => 'http://drupal.org/cron')); // Determine when cron last ran. - $cron_last = Drupal::state()->get('system.cron_last'); + $cron_last = \Drupal::state()->get('system.cron_last'); if (!is_numeric($cron_last)) { $cron_last = variable_get('install_time', 0); } @@ -291,7 +291,7 @@ function system_requirements($phase) { } $description .= ' ' . t('You can run cron manually.', array('@cron' => url('admin/reports/status/run-cron'))); - $description .= '
' . t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . Drupal::state()->get('system.cron_key'), array('absolute' => TRUE)))); + $description .= '
' . t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . \Drupal::state()->get('system.cron_key'), array('absolute' => TRUE)))); $requirements['cron'] = array( 'title' => t('Cron maintenance tasks'), @@ -301,7 +301,7 @@ function system_requirements($phase) { ); } if ($phase != 'install') { - $filesystem_config = Drupal::config('system.file'); + $filesystem_config = \Drupal::config('system.file'); $directories = array( PublicStream::basePath(), // By default no private files directory is configured. For private files @@ -413,7 +413,7 @@ function system_requirements($phase) { ); // Check installed modules. - foreach (Drupal::moduleHandler()->getModuleList() as $module => $filename) { + foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) { $updates = drupal_get_schema_versions($module); if ($updates !== FALSE) { $default = drupal_get_installed_schema_version($module); @@ -476,7 +476,7 @@ function system_requirements($phase) { // Check for an incompatible version. $required_file = $files[$required_module]; $required_name = $required_file->info['name']; - $version = str_replace(Drupal::CORE_COMPATIBILITY . '-', '', $required_file->info['version']); + $version = str_replace(\Drupal::CORE_COMPATIBILITY . '-', '', $required_file->info['version']); $compatibility = drupal_check_incompatibility($requirement, $version); if ($compatibility) { $compatibility = rtrim(substr($compatibility, 2), ')'); @@ -523,13 +523,13 @@ function system_install() { // Enable and set the default theme. Can't use theme_enable() this early in // installation. config_install_default_config('theme', 'stark'); - Drupal::config('system.theme') + \Drupal::config('system.theme') ->set('default', 'stark') ->save(); // Populate the cron key state variable. $cron_key = Crypt::randomStringHashed(55); - Drupal::state()->set('system.cron_key', $cron_key); + \Drupal::state()->set('system.cron_key', $cron_key); } /** @@ -1427,7 +1427,7 @@ function system_update_8013() { function system_update_8014() { // Not using update_variables_to_config(), since the only value is // 'error_level', which needs to be mapped to a new value. - $config = Drupal::config('system.logging'); + $config = \Drupal::config('system.logging'); $error_level = db_query("SELECT value FROM {variable} WHERE name = 'error_level'")->fetchField(); if ($error_level !== FALSE) { $error_level = unserialize($error_level); @@ -1688,7 +1688,7 @@ function system_update_8028() { */ function system_update_8029() { if ($value = update_variable_get('path_alias_whitelist', FALSE)) { - Drupal::state()->set('system.path_alias_whitelist', $value); + \Drupal::state()->set('system.path_alias_whitelist', $value); } update_variable_del('path_alias_whitelist'); } @@ -1884,7 +1884,7 @@ function system_update_8045() { if (!empty($date_formats)) { foreach ($date_formats as $type => $format) { // Set name and locked properties. - $config = Drupal::config("system.date_format.$type") + $config = \Drupal::config("system.date_format.$type") ->set('id', $type) ->set('label', $format['title']) ->set('locked', $format['locked']) @@ -1929,7 +1929,7 @@ function system_update_8046() { update_install_default_config('module', 'views.view.user_admin_people', 'user'); update_install_default_config('module', 'views.view.content', 'node'); - $front_page = Drupal::config('system.site')->get('page.front') ?: 'node'; + $front_page = \Drupal::config('system.site')->get('page.front') ?: 'node'; if ($front_page == 'node') { // This imports the node frontpage view. update_install_default_config('module', 'views.view.frontpage', 'node'); @@ -2132,7 +2132,7 @@ function system_update_8055() { // Convert array of theme settings from Drupal 7's variable system to Drupal // 8's configuration management system. foreach ($theme_settings_to_config_map as $variable => $config_name) { - $config = Drupal::config($config_name); + $config = \Drupal::config($config_name); $theme_settings = update_variable_get($variable); if (!empty($theme_settings)) { theme_settings_convert_to_config($theme_settings, $config)->save(); @@ -2176,7 +2176,7 @@ function system_update_8056() { foreach ($entity_view_modes as $entity_type => $view_modes) { foreach ($view_modes as $key => $name) { $status = in_array($key, array('teaser', 'compact')); - Drupal::config("entity.view_mode.$entity_type.$key") + \Drupal::config("entity.view_mode.$entity_type.$key") ->set('id', "$entity_type.$key") ->set('label', $name) ->set('targetEntityType', $entity_type) @@ -2193,14 +2193,14 @@ function system_update_8056() { */ function system_update_8057() { $actions = db_query("SELECT * FROM {actions}")->fetchAllAssoc('aid', PDO::FETCH_ASSOC); - $action_plugins = Drupal::service('plugin.manager.action')->getDefinitions(); + $action_plugins = \Drupal::service('plugin.manager.action')->getDefinitions(); foreach ($actions as $action) { if (isset($action_plugins[$action['callback']])) { if (is_numeric($action['aid'])) { $action['aid'] = $action['callback'] . '_' . $action['aid']; } $configuration = unserialize($action['parameters']) ?: array(); - Drupal::config('system.action.' . $action['aid']) + \Drupal::config('system.action.' . $action['aid']) ->set('id', $action['aid']) ->set('label', $action['label']) ->set('status', '1') diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 2ea0707..3fca449 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -219,7 +219,7 @@ function system_permission() { ), 'view the administration theme' => array( 'title' => t('View the administration theme'), - 'description' => Drupal::config('system.theme')->get('admin') ?: t('This is only used when the site is configured to use a separate administration theme on the Appearance page.', array('@appearance-url' => url('admin/appearance'))), + 'description' => \Drupal::config('system.theme')->get('admin') ?: t('This is only used when the site is configured to use a separate administration theme on the Appearance page.', array('@appearance-url' => url('admin/appearance'))), ), 'access site reports' => array( 'title' => t('View site reports'), @@ -932,7 +932,7 @@ function _system_batch_theme() { // Retrieve the current state of the batch. $batch = &batch_get(); if (!$batch && isset($_REQUEST['id'])) { - $batch = Drupal::service('batch.storage')->load($_REQUEST['id']); + $batch = \Drupal::service('batch.storage')->load($_REQUEST['id']); } // Use the same theme as the page that started the batch. if (!empty($batch['theme'])) { @@ -947,7 +947,7 @@ function system_library_info() { // Drupal-specific JavaScript. $libraries['drupal'] = array( 'title' => 'Drupal', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/drupal.js' => array('group' => JS_LIBRARY, 'weight' => -18), ), @@ -959,7 +959,7 @@ function system_library_info() { // Drupal settings. $libraries['drupalSettings'] = array( 'title' => 'Drupal Settings', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( array('type' => 'setting', 'data' => array()), ), @@ -969,7 +969,7 @@ function system_library_info() { $libraries['drupal.ajax'] = array( 'title' => 'Drupal AJAX', 'website' => 'http://api.drupal.org/api/group/ajax/8', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/ajax.js' => array('group' => JS_LIBRARY, 'weight' => 2), ), @@ -985,7 +985,7 @@ function system_library_info() { // Drupal's Screen Reader change announcement utility. $libraries['drupal.announce'] = array( 'title' => 'Drupal announce', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/announce.js' => array('group' => JS_LIBRARY), ), @@ -998,7 +998,7 @@ function system_library_info() { // Drupal's batch API. $libraries['drupal.batch'] = array( 'title' => 'Drupal batch API', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/batch.js' => array('group' => JS_DEFAULT, 'cache' => FALSE), ), @@ -1015,7 +1015,7 @@ function system_library_info() { // Drupal's progress indicator. $libraries['drupal.progress'] = array( 'title' => 'Drupal progress indicator', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/progress.js' => array('group' => JS_DEFAULT), ), @@ -1029,7 +1029,7 @@ function system_library_info() { // Drupal's form library. $libraries['drupal.form'] = array( 'title' => 'Drupal form library', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/form.js' => array('group' => JS_LIBRARY, 'weight' => 1), ), @@ -1044,7 +1044,7 @@ function system_library_info() { // Drupal's dialog component. $libraries['drupal.dialog'] = array( 'title' => 'Drupal Dialog', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/dialog.js' => array('group' => JS_LIBRARY), ), @@ -1063,7 +1063,7 @@ function system_library_info() { // Drupal's integration between AJAX and dialogs. $libraries['drupal.dialog.ajax'] = array( 'title' => 'Drupal Dialog AJAX', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/dialog.ajax.js' => array('group' => JS_LIBRARY, 'weight' => 3), ), @@ -1079,7 +1079,7 @@ function system_library_info() { // Drupal's states library. $libraries['drupal.states'] = array( 'title' => 'Drupal states', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/states.js' => array('group' => JS_LIBRARY, 'weight' => 1), ), @@ -1094,7 +1094,7 @@ function system_library_info() { // Drupal's tabledrag library. $libraries['drupal.tabledrag'] = array( 'title' => 'Drupal tabledrag', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/tabledrag.js' => array('group' => JS_LIBRARY, 'weight' => -1), ), @@ -1111,7 +1111,7 @@ function system_library_info() { // Drupal's responsive table API. $libraries['drupal.tableresponsive'] = array( 'title' => 'Drupal responsive table API', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/tableresponsive.js' => array('group' => JS_LIBRARY), ), @@ -1125,7 +1125,7 @@ function system_library_info() { // Collapsible details. $libraries['drupal.collapse'] = array( 'title' => 'Collapsible details', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/collapse.js' => array('group' => JS_DEFAULT), ), @@ -1142,7 +1142,7 @@ function system_library_info() { // Drupal's autocomplete widget. $libraries['drupal.autocomplete'] = array( 'title' => 'Drupal autocomplete', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/autocomplete.js' => array('group' => JS_DEFAULT), ), @@ -1158,7 +1158,7 @@ function system_library_info() { // elements like the overlay. $libraries['drupal.displace'] = array( 'title' => 'Drupal displace', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/displace.js' => array('group' => JS_LIBRARY), ), @@ -1172,7 +1172,7 @@ function system_library_info() { // Manages tab orders in the document. $libraries['drupal.tabbingmanager'] = array( 'title' => 'Drupal tabbing manager', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/tabbingmanager.js' => array('group' => JS_LIBRARY), ), @@ -1187,7 +1187,7 @@ function system_library_info() { // A utility function to limit calls to a function with a given time. $libraries['drupal.debounce'] = array( 'title' => 'Drupal debounce', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/debounce.js' => array('group' => JS_LIBRARY), ), @@ -1301,7 +1301,7 @@ function system_library_info() { $libraries['matchmedia'] = array( 'title' => 'window.matchMedia polyfill', 'website' => 'http://drupal.org/node/1815602', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/matchmedia.js' => array(), ), @@ -1372,7 +1372,7 @@ function system_library_info() { // Drupal's base CSS. $libraries['drupal.base'] = array( 'title' => 'Drupal base CSS', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'css' => array( 'core/misc/drupal.base.css' => array( 'every_page' => TRUE, @@ -1872,7 +1872,7 @@ function system_library_info() { ); $libraries['drupal.tableselect'] = array( 'title' => 'Tableselect', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/tableselect.js' => array(), ), @@ -1883,7 +1883,7 @@ function system_library_info() { ); $libraries['drupal.tableheader'] = array( 'title' => 'Table header', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/tableheader.js' => array(), ), @@ -1897,7 +1897,7 @@ function system_library_info() { ); $libraries['drupal.timezone'] = array( 'title' => 'Timezone', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/timezone.js' => array(), ), @@ -1908,7 +1908,7 @@ function system_library_info() { ); $libraries['drupal.machine-name'] = array( 'title' => 'Machine name', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( 'core/misc/machine-name.js' => array(), ), @@ -1922,7 +1922,7 @@ function system_library_info() { $libraries['drupal.system'] = array( 'title' => 'System', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'system') . '/system.js' => array(), ), @@ -1935,7 +1935,7 @@ function system_library_info() { ); $libraries['drupal.system.modules'] = array( 'title' => 'System modules', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'system') . '/system.modules.js' => array(), ), @@ -1969,7 +1969,7 @@ function system_stream_wrappers() { ); // Only register the private file stream wrapper if a file path has been set. - if (Drupal::config('system.file')->get('path.private')) { + if (\Drupal::config('system.file')->get('path.private')) { $wrappers['private'] = array( 'name' => t('Private files'), 'class' => 'Drupal\Core\StreamWrapper\PrivateStream', @@ -2204,7 +2204,7 @@ function system_custom_theme() { $request = drupal_container()->get('request'); $path = $request->attributes->get('_system_path'); if (user_access('view the administration theme') && path_is_admin($path)) { - return Drupal::config('system.theme')->get('admin'); + return \Drupal::config('system.theme')->get('admin'); } } } @@ -2213,7 +2213,7 @@ function system_custom_theme() { * Implements hook_form_FORM_ID_alter(). */ function system_form_user_form_alter(&$form, &$form_state) { - if (Drupal::config('system.date')->get('timezone.user.configurable')) { + if (\Drupal::config('system.date')->get('timezone.user.configurable')) { system_user_timezone($form, $form_state); } } @@ -2222,7 +2222,7 @@ function system_form_user_form_alter(&$form, &$form_state) { * Implements hook_form_FORM_ID_alter(). */ function system_form_user_register_form_alter(&$form, &$form_state) { - $config = Drupal::config('system.date'); + $config = \Drupal::config('system.date'); if ($config->get('timezone.user.configurable') && $config->get('timezone.user.default') == DRUPAL_USER_TIMEZONE_SELECT) { system_user_timezone($form, $form_state); } @@ -2232,7 +2232,7 @@ function system_form_user_register_form_alter(&$form, &$form_state) { * Implements hook_user_presave(). */ function system_user_presave(UserInterface $account) { - $config = Drupal::config('system.date'); + $config = \Drupal::config('system.date'); if ($config->get('timezone.user.configurable') && !$account->getTimeZone() && !$config->get('timezone.user.default')) { $account->timezone = $config->get('timezone.default'); } @@ -2242,7 +2242,7 @@ function system_user_presave(UserInterface $account) { * Implements hook_user_login(). */ function system_user_login($account) { - $config = Drupal::config('system.date'); + $config = \Drupal::config('system.date'); // If the user has a NULL time zone, notify them to set a time zone. if (!$account->getTimezone() && $config->get('timezone.user.configurable') && $config->get('timezone.user.warn')) { drupal_set_message(t('Configure your account time zone setting.', array('@user-edit' => url("user/$account->id()/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone'))))); @@ -2264,7 +2264,7 @@ function system_user_timezone(&$form, &$form_state) { $form['timezone']['timezone'] = array( '#type' => 'select', '#title' => t('Time zone'), - '#default_value' => $account->getTimezone() ? $account->getTimezone() : Drupal::config('system.date')->get('timezone.default'), + '#default_value' => $account->getTimezone() ? $account->getTimezone() : \Drupal::config('system.date')->get('timezone.default'), '#options' => system_time_zones($account->id() != $user->id()), '#description' => t('Select the desired local time and time zone. Dates and times throughout this site will be displayed using this time zone.'), ); @@ -2367,7 +2367,7 @@ function system_get_info($type, $name = NULL) { $info = array(); if ($type == 'module') { $data = system_rebuild_module_data(); - foreach (Drupal::moduleHandler()->getModuleList() as $module => $filename) { + foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) { if (isset($data[$module])) { $info[$module] = $data[$module]->info; } @@ -2501,8 +2501,8 @@ function system_rebuild_module_data() { $files = array(); ksort($modules); // Add name, status, weight, and schema version. - $enabled_modules = (array) Drupal::config('system.module')->get('enabled'); - $disabled_modules = (array) Drupal::config('system.module.disabled')->get(); + $enabled_modules = (array) \Drupal::config('system.module')->get('enabled'); + $disabled_modules = (array) \Drupal::config('system.module.disabled')->get(); $all_modules = $enabled_modules + $disabled_modules; foreach ($modules as $module => $record) { $record->name = $module; @@ -2511,12 +2511,12 @@ function system_rebuild_module_data() { $record->schema_version = SCHEMA_UNINSTALLED; $files[$module] = $record->filename; } - $modules = Drupal::moduleHandler()->buildModuleDependencies($modules); + $modules = \Drupal::moduleHandler()->buildModuleDependencies($modules); $modules_cache = $modules; // Store filenames to allow system_list() and drupal_get_filename() to // retrieve them without having to rebuild or scan the filesystem. - Drupal::state()->set('system.module.files', $files); + \Drupal::state()->set('system.module.files', $files); } return $modules_cache; } @@ -2531,7 +2531,7 @@ function _system_rebuild_theme_data() { // Find themes $themes = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.info.yml$/', 'themes'); // Allow modules to add further themes. - if ($module_themes = Drupal::moduleHandler()->invokeAll('system_theme_info')) { + if ($module_themes = \Drupal::moduleHandler()->invokeAll('system_theme_info')) { foreach ($module_themes as $name => $uri) { // @see file_scan_directory() $themes[$name] = (object) array( @@ -2655,7 +2655,7 @@ function system_rebuild_theme_data() { // based on the current config. Remove this code when themes have a proper // installation status. // @see http://drupal.org/node/1067408 - $enabled_themes = (array) Drupal::config('system.theme')->get('enabled'); + $enabled_themes = (array) \Drupal::config('system.theme')->get('enabled'); $files = array(); foreach ($themes as $name => $theme) { $theme->status = (int) isset($enabled_themes[$name]); @@ -2663,11 +2663,11 @@ function system_rebuild_theme_data() { } // Replace last known theme data state. // @todo Obsolete with proper installation status for themes. - Drupal::state()->set('system.theme.data', $themes); + \Drupal::state()->set('system.theme.data', $themes); // Store filenames to allow system_list() and drupal_get_filename() to // retrieve them without having to rebuild or scan the filesystem. - Drupal::state()->set('system.theme.files', $files); + \Drupal::state()->set('system.theme.files', $files); return $themes; } @@ -2882,7 +2882,7 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL, function system_admin_compact_mode() { // PHP converts dots into underscores in cookie names to avoid problems with // its parser, so we use a converted cookie name. - return isset($_COOKIE['Drupal_visitor_admin_compact_mode']) ? $_COOKIE['Drupal_visitor_admin_compact_mode'] : Drupal::config('system.site')->get('admin_compact_mode'); + return isset($_COOKIE['Drupal_visitor_admin_compact_mode']) ? $_COOKIE['Drupal_visitor_admin_compact_mode'] : \Drupal::config('system.site')->get('admin_compact_mode'); } /** @@ -2947,7 +2947,7 @@ function system_get_module_admin_tasks($module, $info) { } // Append link for permissions. - if (Drupal::moduleHandler()->implementsHook($module, 'permission')) { + if (\Drupal::moduleHandler()->implementsHook($module, 'permission')) { $item = menu_get_item('admin/people/permissions'); if (!empty($item['access'])) { $item['link_path'] = $item['href']; @@ -2969,7 +2969,7 @@ function system_get_module_admin_tasks($module, $info) { */ function system_cron() { // Cleanup the flood. - Drupal::service('flood')->garbageCollection(); + \Drupal::service('flood')->garbageCollection(); foreach (Cache::getBins() as $cache_backend) { $cache_backend->garbageCollection(); @@ -2996,7 +2996,7 @@ function system_cron() { * Implements hook_mail(). */ function system_mail($key, &$message, $params) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $context = $params['context']; @@ -3099,7 +3099,7 @@ function system_retrieve_file($url, $destination = NULL, $managed = FALSE, $repl } } try { - $data = Drupal::httpClient() + $data = \Drupal::httpClient() ->get($url) ->send() ->getBody(TRUE); @@ -3143,8 +3143,8 @@ function system_run_automated_cron() { // If the site is not fully installed, suppress the automated cron run. // Otherwise it could be triggered prematurely by Ajax requests during // installation. - if (($threshold = Drupal::config('system.cron')->get('threshold.autorun')) > 0 && variable_get('install_task') == 'done') { - $cron_last = Drupal::state()->get('system.cron_last') ?: NULL; + if (($threshold = \Drupal::config('system.cron')->get('threshold.autorun')) > 0 && variable_get('install_task') == 'done') { + $cron_last = \Drupal::state()->get('system.cron_last') ?: NULL; if (!isset($cron_last) || (REQUEST_TIME - $cron_last > $threshold)) { drupal_cron_run(); } diff --git a/core/modules/system/system.tokens.inc b/core/modules/system/system.tokens.inc index 2dca362..4c27e2c 100644 --- a/core/modules/system/system.tokens.inc +++ b/core/modules/system/system.tokens.inc @@ -85,7 +85,7 @@ function system_token_info() { * Implements hook_tokens(). */ function system_tokens($type, $tokens, array $data = array(), array $options = array()) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $url_options = array('absolute' => TRUE); if (isset($options['langcode'])) { @@ -103,17 +103,17 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a foreach ($tokens as $name => $original) { switch ($name) { case 'name': - $site_name = Drupal::config('system.site')->get('name'); + $site_name = \Drupal::config('system.site')->get('name'); $replacements[$original] = $sanitize ? check_plain($site_name) : $site_name; break; case 'slogan': - $slogan = Drupal::config('system.site')->get('slogan'); + $slogan = \Drupal::config('system.site')->get('slogan'); $replacements[$original] = $sanitize ? filter_xss_admin($slogan) : $slogan; break; case 'mail': - $replacements[$original] = Drupal::config('system.site')->get('mail'); + $replacements[$original] = \Drupal::config('system.site')->get('mail'); break; case 'url': diff --git a/core/modules/system/tests/modules/batch_test/batch_test.module b/core/modules/system/tests/modules/batch_test/batch_test.module index cc1c715..d10c424 100644 --- a/core/modules/system/tests/modules/batch_test/batch_test.module +++ b/core/modules/system/tests/modules/batch_test/batch_test.module @@ -448,12 +448,12 @@ function _batch_test_theme_callback() { */ function batch_test_stack($data = NULL, $reset = FALSE) { if ($reset) { - Drupal::state()->delete('batch_test.stack'); + \Drupal::state()->delete('batch_test.stack'); } if (!isset($data)) { - return Drupal::state()->get('batch_test.stack'); + return \Drupal::state()->get('batch_test.stack'); } - $stack = Drupal::state()->get('batch_test.stack'); + $stack = \Drupal::state()->get('batch_test.stack'); $stack[] = $data; - Drupal::state()->set('batch_test.stack', $stack); + \Drupal::state()->set('batch_test.stack', $stack); } diff --git a/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module b/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module index ef3ac88..ee280a3 100644 --- a/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module +++ b/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module @@ -14,5 +14,5 @@ * @see common_test_cron() */ function common_test_cron_helper_cron() { - Drupal::state()->set('common_test.cron', 'success'); + \Drupal::state()->set('common_test.cron', 'success'); } diff --git a/core/modules/system/tests/modules/design_test/design_test.module b/core/modules/system/tests/modules/design_test/design_test.module index 334ea31..dadcaba 100644 --- a/core/modules/system/tests/modules/design_test/design_test.module +++ b/core/modules/system/tests/modules/design_test/design_test.module @@ -96,7 +96,7 @@ function design_test_menu_local_tasks_alter(&$data, $router_item, $root_path) { $actions = &$data['actions']['output']; // Determine the currently selected theme, if any. $selected_theme = drupal_container()->get('request')->query->get('theme'); - $default_theme = Drupal::config('system.theme')->get('default'); + $default_theme = \Drupal::config('system.theme')->get('default'); // Expand all enabled themes into action links. $themes = list_themes(); diff --git a/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module index 962114c..e7041c4 100644 --- a/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module +++ b/core/modules/system/tests/modules/entity_cache_test/entity_cache_test.module @@ -21,6 +21,6 @@ function entity_cache_test_watchdog($log_entry) { $info = entity_get_info('entity_cache_test'); // Store the information in a system variable to analyze it later in the // test case. - Drupal::state()->set('entity_cache_test', $info); + \Drupal::state()->set('entity_cache_test', $info); } } diff --git a/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module b/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module index f2e9873..004f531 100644 --- a/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module +++ b/core/modules/system/tests/modules/entity_cache_test_dependency/entity_cache_test_dependency.module @@ -9,5 +9,5 @@ * Implements hook_entity_info_alter(). */ function entity_cache_test_dependency_entity_info_alter(&$info) { - $info['entity_cache_test']['label'] = Drupal::state()->get('entity_cache_test.label') ?: 'Entity Cache Test'; + $info['entity_cache_test']['label'] = \Drupal::state()->get('entity_cache_test.label') ?: 'Entity Cache Test'; } diff --git a/core/modules/system/tests/modules/entity_test/entity_test.module b/core/modules/system/tests/modules/entity_test/entity_test.module index b401470..88fc46e 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.module +++ b/core/modules/system/tests/modules/entity_test/entity_test.module @@ -59,7 +59,7 @@ function entity_test_entity_types($filter = NULL) { */ function entity_test_entity_info_alter(&$info) { // Optionally specify a translation handler for testing translations. - if (Drupal::state()->get('entity_test.translation')) { + if (\Drupal::state()->get('entity_test.translation')) { foreach(entity_test_entity_types() as $entity_type) { $info[$entity_type]['translation'][$entity_type] = TRUE; } @@ -79,9 +79,9 @@ function entity_test_entity_info_alter(&$info) { * 'entity_test'. */ function entity_test_create_bundle($bundle, $text = NULL, $entity_type = 'entity_test') { - $bundles = Drupal::state()->get($entity_type . '.bundles') ?: array('entity_test' => array('label' => 'Entity Test Bundle')); + $bundles = \Drupal::state()->get($entity_type . '.bundles') ?: array('entity_test' => array('label' => 'Entity Test Bundle')); $bundles += array($bundle => array('label' => $text ? $text : $bundle)); - Drupal::state()->set($entity_type . '.bundles', $bundles); + \Drupal::state()->set($entity_type . '.bundles', $bundles); entity_invoke_bundle_hook('create', $entity_type, $bundle); } @@ -98,10 +98,10 @@ function entity_test_create_bundle($bundle, $text = NULL, $entity_type = 'entity * 'entity_test'. */ function entity_test_rename_bundle($bundle_old, $bundle_new, $entity_type = 'entity_test') { - $bundles = Drupal::state()->get($entity_type . '.bundles') ?: array('entity_test' => array('label' => 'Entity Test Bundle')); + $bundles = \Drupal::state()->get($entity_type . '.bundles') ?: array('entity_test' => array('label' => 'Entity Test Bundle')); $bundles[$bundle_new] = $bundles[$bundle_old]; unset($bundles[$bundle_old]); - Drupal::state()->set($entity_type . '.bundles', $bundles); + \Drupal::state()->set($entity_type . '.bundles', $bundles); entity_invoke_bundle_hook('rename', $entity_type, $bundle_old, $bundle_new); } @@ -116,9 +116,9 @@ function entity_test_rename_bundle($bundle_old, $bundle_new, $entity_type = 'ent * 'entity_test'. */ function entity_test_delete_bundle($bundle, $entity_type = 'entity_test') { - $bundles = Drupal::state()->get($entity_type . '.bundles') ?: array('entity_test' => array('label' => 'Entity Test Bundle')); + $bundles = \Drupal::state()->get($entity_type . '.bundles') ?: array('entity_test' => array('label' => 'Entity Test Bundle')); unset($bundles[$bundle]); - Drupal::state()->set($entity_type . '.bundles', $bundles); + \Drupal::state()->set($entity_type . '.bundles', $bundles); entity_invoke_bundle_hook('delete', $entity_type, $bundle); } @@ -131,7 +131,7 @@ function entity_test_entity_bundle_info() { $entity_info = entity_get_info(); foreach ($entity_info as $entity_type => $info) { if ($info['module'] == 'entity_test') { - $bundles[$entity_type] = Drupal::state()->get($entity_type . '.bundles') ?: array($entity_type => array('label' => 'Entity Test Bundle')); + $bundles[$entity_type] = \Drupal::state()->get($entity_type . '.bundles') ?: array($entity_type => array('label' => 'Entity Test Bundle')); } } return $bundles; @@ -242,7 +242,7 @@ function entity_test_menu() { */ function entity_test_form_node_form_alter(&$form, &$form_state, $form_id) { $langcode = $form_state['controller']->getFormLangcode($form_state); - Drupal::state()->set('entity_test.form_langcode', $langcode); + \Drupal::state()->set('entity_test.form_langcode', $langcode); } /** @@ -259,7 +259,7 @@ function entity_test_form_node_form_alter(&$form, &$form_state, $form_id) { function entity_test_add($entity_type) { drupal_set_title(t('Create an @type', array('@type' => $entity_type))); $entity = entity_create($entity_type, array()); - return Drupal::entityManager()->getForm($entity); + return \Drupal::entityManager()->getForm($entity); } /** @@ -275,7 +275,7 @@ function entity_test_add($entity_type) { */ function entity_test_edit(EntityInterface $entity) { drupal_set_title($entity->label(), PASS_THROUGH); - return Drupal::entityManager()->getForm($entity); + return \Drupal::entityManager()->getForm($entity); } /** diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module index 5315f00..9673d60 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -444,7 +444,7 @@ function menu_test_local_action_dynamic_title($arg) { * several local tasks to menu-test/tasks. */ function menu_test_menu_local_tasks(&$data, $router_item, $root_path) { - if (!Drupal::config('menu_test.settings')->get('tasks.add')) { + if (!\Drupal::config('menu_test.settings')->get('tasks.add')) { return; } if (strpos($router_item['tab_root'], 'menu-test/tasks/') === 0) { @@ -474,7 +474,7 @@ function menu_test_menu_local_tasks(&$data, $router_item, $root_path) { * several local tasks to menu-test/tasks. */ function menu_test_menu_local_tasks_alter(&$data, $router_item, $root_path) { - if (!Drupal::config('menu_test.settings')->get('tasks.alter')) { + if (!\Drupal::config('menu_test.settings')->get('tasks.alter')) { return; } if (strpos($router_item['tab_root'], 'menu-test/tasks/') === 0) { @@ -547,7 +547,7 @@ function menu_test_callback() { * @see menu_test_menu(). */ function menu_test_menu_trail_callback() { - $menu_path = Drupal::state()->get('menu_test.menu_tree_set_path') ?: array(); + $menu_path = \Drupal::state()->get('menu_test.menu_tree_set_path') ?: array(); if (!empty($menu_path)) { menu_tree_set_path($menu_path['menu_name'], $menu_path['path']); } @@ -566,8 +566,8 @@ function menu_test_custom_403_404_callback() { // When requested by one of the TrailTest tests, record the final // active trail now that the user has been redirected to the custom 403 or // 404 page. - if (Drupal::state()->get('menu_test.record_active_trail') ?: FALSE) { - Drupal::state()->set('menu_test.active_trail_final', menu_get_active_trail()); + if (\Drupal::state()->get('menu_test.record_active_trail') ?: FALSE) { + \Drupal::state()->set('menu_test.active_trail_final', menu_get_active_trail()); } return 'This is menu_test_custom_403_404_callback().'; @@ -617,7 +617,7 @@ function menu_test_theme_page_callback($inherited = FALSE) { function menu_test_theme_callback($argument) { // Test using the variable administrative theme. if ($argument == 'use-admin-theme') { - return Drupal::config('system.theme')->get('admin'); + return \Drupal::config('system.theme')->get('admin'); } // Test using a theme that exists, but may or may not be enabled. elseif ($argument == 'use-stark-theme') { @@ -642,10 +642,10 @@ function menu_test_custom_theme() { // When requested by one of the MenuTrailTestCase tests, record the initial // active trail during Drupal's bootstrap (before the user is redirected to a // custom 403 or 404 page). See menu_test_custom_403_404_callback(). - if (Drupal::state()->get('menu_test.record_active_trail') ?: FALSE) { - Drupal::state()->set('menu_test.active_trail_initial', menu_get_active_trail()); + if (\Drupal::state()->get('menu_test.record_active_trail') ?: FALSE) { + \Drupal::state()->set('menu_test.active_trail_initial', menu_get_active_trail()); } - if ($theme = Drupal::state()->get('menu_test.hook_custom_theme_name') ?: FALSE) { + if ($theme = \Drupal::state()->get('menu_test.hook_custom_theme_name') ?: FALSE) { return $theme; } } diff --git a/core/modules/system/tests/modules/module_test/module_test.file.inc b/core/modules/system/tests/modules/module_test/module_test.file.inc index 1929941..0842944 100644 --- a/core/modules/system/tests/modules/module_test/module_test.file.inc +++ b/core/modules/system/tests/modules/module_test/module_test.file.inc @@ -2,7 +2,7 @@ /** * @file - * A file to test Drupal::moduleHandler()->getImplementations() loading includes. + * A file to test \Drupal::moduleHandler()->getImplementations() loading includes. */ /** diff --git a/core/modules/system/tests/modules/module_test/module_test.module b/core/modules/system/tests/modules/module_test/module_test.module index 4e36d9b..9a2647e 100644 --- a/core/modules/system/tests/modules/module_test/module_test.module +++ b/core/modules/system/tests/modules/module_test/module_test.module @@ -15,7 +15,7 @@ function module_test_permission() { * Manipulate module dependencies to test dependency chains. */ function module_test_system_info_alter(&$info, $file, $type) { - if (Drupal::state()->get('module_test.dependency') == 'missing dependency') { + if (\Drupal::state()->get('module_test.dependency') == 'missing dependency') { if ($file->name == 'forum') { // Make forum module depend on ban. $info['dependencies'][] = 'ban'; @@ -25,7 +25,7 @@ function module_test_system_info_alter(&$info, $file, $type) { $info['dependencies'][] = 'foo'; } } - elseif (Drupal::state()->get('module_test.dependency') == 'dependency') { + elseif (\Drupal::state()->get('module_test.dependency') == 'dependency') { if ($file->name == 'forum') { // Make the forum module depend on ban. $info['dependencies'][] = 'ban'; @@ -35,7 +35,7 @@ function module_test_system_info_alter(&$info, $file, $type) { $info['dependencies'][] = 'xmlrpc'; } } - elseif (Drupal::state()->get('module_test.dependency') == 'version dependency') { + elseif (\Drupal::state()->get('module_test.dependency') == 'version dependency') { if ($file->name == 'forum') { // Make the forum module depend on ban. $info['dependencies'][] = 'ban'; @@ -110,7 +110,7 @@ function module_test_hook_dynamic_loading_invoke() { * return 'success!'. */ function module_test_hook_dynamic_loading_invoke_all() { - $result = Drupal::moduleHandler()->invokeAll('test_hook'); + $result = \Drupal::moduleHandler()->invokeAll('test_hook'); return $result['module_test']; } @@ -130,7 +130,7 @@ function module_test_hook_dynamic_loading_invoke_all_during_load($param) { * @see module_test_menu(). */ function module_test_load($param) { - $result = Drupal::moduleHandler()->invokeAll('test_hook'); + $result = \Drupal::moduleHandler()->invokeAll('test_hook'); return $result[$param]; } @@ -155,7 +155,7 @@ function module_test_class_loading() { function module_test_modules_enabled($modules) { // Record the ordered list of modules that were passed in to this hook so we // can check that the modules were enabled in the correct sequence. - Drupal::state()->set('system_test.module_enable_order', $modules); + \Drupal::state()->set('system_test.module_enable_order', $modules); } /** @@ -164,7 +164,7 @@ function module_test_modules_enabled($modules) { function module_test_modules_disabled($modules) { // Record the ordered list of modules that were passed in to this hook so we // can check that the modules were disabled in the correct sequence. - Drupal::state()->set('module_test.disable_order', $modules); + \Drupal::state()->set('module_test.disable_order', $modules); } /** @@ -173,5 +173,5 @@ function module_test_modules_disabled($modules) { function module_test_modules_uninstalled($modules) { // Record the ordered list of modules that were passed in to this hook so we // can check that the modules were uninstalled in the correct sequence. - Drupal::state()->set('module_test.uninstall_order', $modules); + \Drupal::state()->set('module_test.uninstall_order', $modules); } diff --git a/core/modules/system/tests/modules/path_test/path_test.module b/core/modules/system/tests/modules/path_test/path_test.module index 6f4d580..df03931 100644 --- a/core/modules/system/tests/modules/path_test/path_test.module +++ b/core/modules/system/tests/modules/path_test/path_test.module @@ -9,14 +9,14 @@ * Resets the path test results. */ function path_test_reset() { - Drupal::state()->set('path_test.results', array()); + \Drupal::state()->set('path_test.results', array()); } /** * Implements hook_path_update(). */ function path_test_path_update($path) { - $results = Drupal::state()->get('path_test.results') ?: array(); + $results = \Drupal::state()->get('path_test.results') ?: array(); $results['hook_path_update'] = $path; - Drupal::state()->set('path_test.results', $results); + \Drupal::state()->set('path_test.results', $results); } diff --git a/core/modules/system/tests/modules/system_test/system_test.module b/core/modules/system/tests/modules/system_test/system_test.module index ea10a04..2236873 100644 --- a/core/modules/system/tests/modules/system_test/system_test.module +++ b/core/modules/system/tests/modules/system_test/system_test.module @@ -90,7 +90,7 @@ function system_test_set_header() { * Implements hook_modules_installed(). */ function system_test_modules_installed($modules) { - if (Drupal::state()->get('system_test.verbose_module_hooks')) { + if (\Drupal::state()->get('system_test.verbose_module_hooks')) { foreach ($modules as $module) { drupal_set_message(t('hook_modules_installed fired for @module', array('@module' => $module))); } @@ -101,7 +101,7 @@ function system_test_modules_installed($modules) { * Implements hook_modules_enabled(). */ function system_test_modules_enabled($modules) { - if (Drupal::state()->get('system_test.verbose_module_hooks')) { + if (\Drupal::state()->get('system_test.verbose_module_hooks')) { foreach ($modules as $module) { drupal_set_message(t('hook_modules_enabled fired for @module', array('@module' => $module))); } @@ -112,7 +112,7 @@ function system_test_modules_enabled($modules) { * Implements hook_modules_disabled(). */ function system_test_modules_disabled($modules) { - if (Drupal::state()->get('system_test.verbose_module_hooks')) { + if (\Drupal::state()->get('system_test.verbose_module_hooks')) { foreach ($modules as $module) { drupal_set_message(t('hook_modules_disabled fired for @module', array('@module' => $module))); } @@ -123,7 +123,7 @@ function system_test_modules_disabled($modules) { * Implements hook_modules_uninstalled(). */ function system_test_modules_uninstalled($modules) { - if (Drupal::state()->get('system_test.verbose_module_hooks')) { + if (\Drupal::state()->get('system_test.verbose_module_hooks')) { foreach ($modules as $module) { drupal_set_message(t('hook_modules_uninstalled fired for @module', array('@module' => $module))); } @@ -136,11 +136,11 @@ function system_test_modules_uninstalled($modules) { function system_test_system_info_alter(&$info, $file, $type) { // We need a static otherwise the last test will fail to alter common_test. static $test; - if (($dependencies = Drupal::state()->get('system_test.dependencies')) || $test) { + if (($dependencies = \Drupal::state()->get('system_test.dependencies')) || $test) { if ($file->name == 'module_test') { $info['hidden'] = FALSE; $info['dependencies'][] = array_shift($dependencies); - Drupal::state()->set('system_test.dependencies', $dependencies); + \Drupal::state()->set('system_test.dependencies', $dependencies); $test = TRUE; } if ($file->name == 'common_test') { @@ -212,7 +212,7 @@ function system_test_page_build(&$page) { drupal_set_page_content(); } // Used by FrontPageTestCase to get the results of drupal_is_front_page(). - $frontpage = Drupal::state()->get('system_test.front_page_output') ?: 0; + $frontpage = \Drupal::state()->get('system_test.front_page_output') ?: 0; if ($frontpage && drupal_is_front_page()) { drupal_set_message(t('On front page.')); } diff --git a/core/modules/system/tests/modules/update_script_test/update_script_test.install b/core/modules/system/tests/modules/update_script_test/update_script_test.install index c5c9e59..594dfa3 100644 --- a/core/modules/system/tests/modules/update_script_test/update_script_test.install +++ b/core/modules/system/tests/modules/update_script_test/update_script_test.install @@ -13,7 +13,7 @@ function update_script_test_requirements($phase) { if ($phase == 'update') { // Set a requirements warning or error when the test requests it. - $requirement_type = Drupal::config('update_script_test.settings')->get('requirement_type'); + $requirement_type = \Drupal::config('update_script_test.settings')->get('requirement_type'); switch ($requirement_type) { case REQUIREMENT_WARNING: $requirements['update_script_test'] = array( diff --git a/core/modules/system/tests/modules/update_test_1/update_test_1.install b/core/modules/system/tests/modules/update_test_1/update_test_1.install index 3ac73db..bfb7170 100644 --- a/core/modules/system/tests/modules/update_test_1/update_test_1.install +++ b/core/modules/system/tests/modules/update_test_1/update_test_1.install @@ -11,7 +11,7 @@ * @see update_test_2_update_dependencies() */ function update_test_1_update_dependencies() { - Drupal::state()->set('update_test_1_update_dependencies_run', TRUE); + \Drupal::state()->set('update_test_1_update_dependencies_run', TRUE); // These dependencies are used in combination with those declared in // update_test_2_update_dependencies() for the sole purpose of testing that // the results of hook_update_dependencies() are collected correctly and have diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install index 7648ba0..476ab2e 100644 --- a/core/modules/taxonomy/taxonomy.install +++ b/core/modules/taxonomy/taxonomy.install @@ -13,7 +13,7 @@ * Implements hook_uninstall(). */ function taxonomy_uninstall() { - Drupal::entityManager()->addNamespaces(new ArrayIterator(array( + \Drupal::entityManager()->addNamespaces(new ArrayIterator(array( 'Drupal\taxonomy' => DRUPAL_ROOT . '/core/modules/taxonomy/lib', ))); drupal_classloader_register('taxonomy', 'core/modules/taxonomy'); @@ -323,7 +323,7 @@ function taxonomy_update_8005() { $result = db_query('SELECT * FROM {taxonomy_vocabulary}'); foreach ($result as $vocabulary) { - $config = Drupal::config('taxonomy.vocabulary.' . $vocabulary->machine_name) + $config = \Drupal::config('taxonomy.vocabulary.' . $vocabulary->machine_name) ->set('vid', $vocabulary->machine_name) ->set('name', $vocabulary->name) ->set('uuid', !empty($vocabulary->uuid) ? $vocabulary->uuid : $uuid->generate()) @@ -365,7 +365,7 @@ function taxonomy_update_8006() { */ function taxonomy_update_8007() { foreach (config_get_storage_names_with_prefix('field.field.') as $config_name) { - $field_config = Drupal::config($config_name); + $field_config = \Drupal::config($config_name); // Only update taxonomy reference fields that use the default SQL storage. if ($field_config->get('type') == 'taxonomy_term_reference') { $field = new Field($field_config->get()); diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 0827bef..1a69769 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -114,7 +114,7 @@ function taxonomy_permission() { function taxonomy_entity_bundle_info() { $bundles = array(); foreach (taxonomy_vocabulary_get_names() as $id) { - $config = Drupal::config('taxonomy.vocabulary.' . $id); + $config = \Drupal::config('taxonomy.vocabulary.' . $id); $bundles['taxonomy_term'][$id]['label'] = $config->get('name'); } return $bundles; @@ -182,7 +182,7 @@ function taxonomy_field_extra_fields() { * An array of nids matching the query. */ function taxonomy_select_nodes($tid, $pager = TRUE, $limit = FALSE, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC')) { - if (!Drupal::config('taxonomy.settings')->get('maintain_index_table')) { + if (!\Drupal::config('taxonomy.settings')->get('maintain_index_table')) { return array(); } $query = db_select('taxonomy_index', 't'); @@ -474,7 +474,7 @@ function taxonomy_term_is_page(Term $term) { * Clear all static cache variables for terms. */ function taxonomy_terms_static_reset() { - Drupal::entityManager()->getStorageController('taxonomy_term')->resetCache(); + \Drupal::entityManager()->getStorageController('taxonomy_term')->resetCache(); } /** @@ -484,7 +484,7 @@ function taxonomy_terms_static_reset() { * An array of ids to reset in entity controller cache. */ function taxonomy_vocabulary_static_reset(array $ids = NULL) { - Drupal::entityManager()->getStorageController('taxonomy_vocabulary')->resetCache($ids); + \Drupal::entityManager()->getStorageController('taxonomy_vocabulary')->resetCache($ids); } /** @@ -1107,7 +1107,7 @@ function taxonomy_node_insert(EntityInterface $node) { function taxonomy_build_node_index($node) { // We maintain a denormalized table of term/node relationships, containing // only data for current, published nodes. - if (!Drupal::config('taxonomy.settings')->get('maintain_index_table') || !(Drupal::entityManager()->getStorageController('node') instanceof DatabaseStorageController)) { + if (!\Drupal::config('taxonomy.settings')->get('maintain_index_table') || !(\Drupal::entityManager()->getStorageController('node') instanceof DatabaseStorageController)) { return; } @@ -1170,7 +1170,7 @@ function taxonomy_node_predelete(EntityInterface $node) { * The node entity. */ function taxonomy_delete_node_index(EntityInterface $node) { - if (Drupal::config('taxonomy.settings')->get('maintain_index_table')) { + if (\Drupal::config('taxonomy.settings')->get('maintain_index_table')) { db_delete('taxonomy_index')->condition('nid', $node->id())->execute(); } } @@ -1179,7 +1179,7 @@ function taxonomy_delete_node_index(EntityInterface $node) { * Implements hook_taxonomy_term_delete(). */ function taxonomy_taxonomy_term_delete(Term $term) { - if (Drupal::config('taxonomy.settings')->get('maintain_index_table')) { + if (\Drupal::config('taxonomy.settings')->get('maintain_index_table')) { // Clean up the {taxonomy_index} table when terms are deleted. db_delete('taxonomy_index')->condition('tid', $term->id())->execute(); } @@ -1195,7 +1195,7 @@ function taxonomy_taxonomy_term_delete(Term $term) { function taxonomy_library_info() { $libraries['drupal.taxonomy'] = array( 'title' => 'Taxonomy', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'taxonomy') . '/taxonomy.js' => array(), ), diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc index f6ffee0..a2fc467 100644 --- a/core/modules/taxonomy/taxonomy.pages.inc +++ b/core/modules/taxonomy/taxonomy.pages.inc @@ -42,7 +42,7 @@ function taxonomy_term_page(Term $term) { } $build['taxonomy_terms'] = taxonomy_term_view_multiple(array($term->id() => $term)); - if ($nids = taxonomy_select_nodes($term->id(), TRUE, Drupal::config('node.settings')->get('items_per_page'))) { + if ($nids = taxonomy_select_nodes($term->id(), TRUE, \Drupal::config('node.settings')->get('items_per_page'))) { $nodes = node_load_multiple($nids); $build['nodes'] = node_view_multiple($nodes); $build['pager'] = array( @@ -68,11 +68,11 @@ function taxonomy_term_page(Term $term) { */ function taxonomy_term_feed(Term $term) { $channel['link'] = url('taxonomy/term/' . $term->id(), array('absolute' => TRUE)); - $channel['title'] = Drupal::config('system.site')->get('name') . ' - ' . $term->label(); + $channel['title'] = \Drupal::config('system.site')->get('name') . ' - ' . $term->label(); // Only display the description if we have a single term, to avoid clutter and confusion. // HTML will be removed from feed description. $channel['description'] = check_markup($term->description->value, $term->format->value, '', TRUE); - $nids = taxonomy_select_nodes($term->id(), FALSE, Drupal::config('system.rss')->get('items.limit')); + $nids = taxonomy_select_nodes($term->id(), FALSE, \Drupal::config('system.rss')->get('items.limit')); return node_feed($nids, $channel); } diff --git a/core/modules/taxonomy/taxonomy.tokens.inc b/core/modules/taxonomy/taxonomy.tokens.inc index 308f66c..ec94447 100644 --- a/core/modules/taxonomy/taxonomy.tokens.inc +++ b/core/modules/taxonomy/taxonomy.tokens.inc @@ -89,7 +89,7 @@ function taxonomy_token_info() { * Implements hook_tokens(). */ function taxonomy_tokens($type, $tokens, array $data = array(), array $options = array()) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $replacements = array(); $sanitize = !empty($options['sanitize']); diff --git a/core/modules/taxonomy/taxonomy.views.inc b/core/modules/taxonomy/taxonomy.views.inc index c33b697..4e9f27c 100644 --- a/core/modules/taxonomy/taxonomy.views.inc +++ b/core/modules/taxonomy/taxonomy.views.inc @@ -248,7 +248,7 @@ function taxonomy_views_data() { ); // Content translation field. - if (Drupal::moduleHandler()->moduleExists('content_translation')) { + if (\Drupal::moduleHandler()->moduleExists('content_translation')) { $data['taxonomy_term_data']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for taxonomy terms.'), diff --git a/core/modules/telephone/telephone.module b/core/modules/telephone/telephone.module index 5445c5b..2d2bd35 100644 --- a/core/modules/telephone/telephone.module +++ b/core/modules/telephone/telephone.module @@ -9,7 +9,7 @@ * Implements hook_field_info_alter(). */ function telephone_field_info_alter(&$info) { - if (Drupal::moduleHandler()->moduleExists('text')) { + if (\Drupal::moduleHandler()->moduleExists('text')) { $info['telephone']['default_formatter'] = 'text_plain'; } } diff --git a/core/modules/text/text.module b/core/modules/text/text.module index 85cea7a..297e60e 100644 --- a/core/modules/text/text.module +++ b/core/modules/text/text.module @@ -13,7 +13,7 @@ function text_library_info() { $libraries['drupal.text'] = array( 'title' => 'Text', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'text') . '/text.js' => array(), ), @@ -65,7 +65,7 @@ function text_help($path, $arg) { function text_summary($text, $format = NULL, $size = NULL) { if (!isset($size)) { - $size = Drupal::config('text.settings')->get('default_summary_length'); + $size = \Drupal::config('text.settings')->get('default_summary_length'); } // Find where the delimiter is in the body diff --git a/core/modules/toolbar/toolbar.module b/core/modules/toolbar/toolbar.module index 43ad735..604e04d 100644 --- a/core/modules/toolbar/toolbar.module +++ b/core/modules/toolbar/toolbar.module @@ -199,7 +199,7 @@ function ($object) { } // Get toolbar items from all modules that implement hook_toolbar(). - $items = Drupal::moduleHandler()->invokeAll('toolbar'); + $items = \Drupal::moduleHandler()->invokeAll('toolbar'); // Allow for altering of hook_toolbar(). drupal_alter('toolbar', $items); // Sort the children. @@ -473,7 +473,7 @@ function toolbar_toolbar() { */ function toolbar_get_menu_tree() { $tree = array(); - $query = Drupal::entityQuery('menu_link') + $query = \Drupal::entityQuery('menu_link') ->condition('menu_name', 'admin') ->condition('module', 'system') ->condition('link_path', 'admin'); @@ -585,7 +585,7 @@ function toolbar_in_active_trail($path) { function toolbar_library_info() { $libraries['toolbar'] = array( 'title' => 'Toolbar', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'toolbar') . '/js/toolbar.js' => array(), ), @@ -609,7 +609,7 @@ function toolbar_library_info() { $libraries['toolbar.menu'] = array( 'title' => 'Toolbar nested accordion menus.', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'toolbar') . '/js/toolbar.menu.js' => array(), ), @@ -630,7 +630,7 @@ function toolbar_library_info() { * Returns the hash of the per-user rendered toolbar subtrees. */ function _toolbar_get_subtree_hash() { - $user = Drupal::currentUser(); + $user = \Drupal::currentUser(); $cid = $user->id() . ':' . language(Language::TYPE_INTERFACE)->id; if ($cache = cache('toolbar')->get($cid)) { $hash = $cache->data; diff --git a/core/modules/tour/tour.api.php b/core/modules/tour/tour.api.php index 1836a13..db0312f 100644 --- a/core/modules/tour/tour.api.php +++ b/core/modules/tour/tour.api.php @@ -72,7 +72,7 @@ function hook_tour_presave($entity) { * The tour object being inserted. */ function hook_tour_insert($entity) { - Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); cache('cache_tour')->deleteTags(array('tour_items')); } @@ -83,6 +83,6 @@ function hook_tour_insert($entity) { * The tour object being updated. */ function hook_tour_update($entity) { - Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); cache('cache_tour')->deleteTags(array('tour_items')); } diff --git a/core/modules/tour/tour.module b/core/modules/tour/tour.module index 9cb4f64..4e410c0 100644 --- a/core/modules/tour/tour.module +++ b/core/modules/tour/tour.module @@ -26,7 +26,7 @@ function tour_library_info() { $libraries['tour'] = array( 'title' => 'Tour', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( // Add the JavaScript, with a group and weight such that it will run // before modules/overlay/overlay-parent.js. @@ -44,7 +44,7 @@ function tour_library_info() { $libraries['tour-styling'] = array( 'title' => 'Tour', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'css' => array( $path . '/css/tour.module.css' => array('media' => 'screen'), ) @@ -73,7 +73,7 @@ function tour_library_info() { * Implements hook_toolbar(). */ function tour_toolbar() { - if (!Drupal::currentUser()->hasPermission('access tour')) { + if (!\Drupal::currentUser()->hasPermission('access tour')) { return; } @@ -107,7 +107,7 @@ function tour_toolbar() { * Implements hook_preprocess_HOOK() for page.tpl.php. */ function tour_preprocess_page(&$variables) { - if (!Drupal::currentUser()->hasPermission('access tour')) { + if (!\Drupal::currentUser()->hasPermission('access tour')) { return; } @@ -117,7 +117,7 @@ function tour_preprocess_page(&$variables) { // Load all of the items and match on path. $tours = entity_load_multiple('tour'); - $path_alias = drupal_strtolower(Drupal::service('path.alias_manager')->getPathAlias($path)); + $path_alias = drupal_strtolower(\Drupal::service('path.alias_manager')->getPathAlias($path)); foreach ($tours as $tour_id => $tour) { // @todo Replace this with an entity query that does path matching when // http://drupal.org/node/1918768 lands. @@ -136,12 +136,12 @@ function tour_preprocess_page(&$variables) { * Implements hook_tour_insert(). */ function tour_tour_insert($entity) { - Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); } /** * Implements hook_tour_update(). */ function tour_tour_update($entity) { - Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.tour.tip')->clearCachedDefinitions(); } diff --git a/core/modules/tracker/tracker.install b/core/modules/tracker/tracker.install index 841d74a..daa2983 100644 --- a/core/modules/tracker/tracker.install +++ b/core/modules/tracker/tracker.install @@ -9,7 +9,7 @@ * Implements hook_uninstall(). */ function tracker_uninstall() { - Drupal::state()->delete('tracker.index_nid'); + \Drupal::state()->delete('tracker.index_nid'); } /** @@ -18,7 +18,7 @@ function tracker_uninstall() { function tracker_enable() { $max_nid = db_query('SELECT MAX(nid) FROM {node}')->fetchField(); if ($max_nid != 0) { - Drupal::state()->set('tracker.index_nid', $max_nid); + \Drupal::state()->set('tracker.index_nid', $max_nid); // To avoid timing out while attempting to do a complete indexing, we // simply call our cron job to remove stale records and begin the process. tracker_cron(); diff --git a/core/modules/tracker/tracker.module b/core/modules/tracker/tracker.module index 80b0d5a..b17b11f 100644 --- a/core/modules/tracker/tracker.module +++ b/core/modules/tracker/tracker.module @@ -81,10 +81,10 @@ function tracker_menu() { * process, 'tracker.index_nid' will be 0. */ function tracker_cron() { - $state = Drupal::state(); + $state = \Drupal::state(); $max_nid = $state->get('tracker.index_nid') ?: 0; if ($max_nid > 0) { - $batch_size = Drupal::config('tracker.settings')->get('cron_index_limit'); + $batch_size = \Drupal::config('tracker.settings')->get('cron_index_limit'); $last_nid = FALSE; // @todo This should be actually filtering on the desired language and just // fall back to the default language. @@ -173,7 +173,7 @@ function tracker_cron() { */ function _tracker_myrecent_access(AccountInterface $account) { // This path is only allowed for authenticated users looking at their own content. - return $account->id() && (Drupal::currentUser()->id() == $account->id()) && $account->hasPermission('access content'); + return $account->id() && (\Drupal::currentUser()->id() == $account->id()) && $account->hasPermission('access content'); } /** diff --git a/core/modules/translation/translation.module b/core/modules/translation/translation.module index f1d7075..f9d7a62 100644 --- a/core/modules/translation/translation.module +++ b/core/modules/translation/translation.module @@ -98,7 +98,7 @@ function _translation_tab_access(NodeInterface $node) { * Implements hook_admin_paths(). */ function translation_admin_paths() { - if (Drupal::config('node.settings')->get('use_admin_theme')) { + if (\Drupal::config('node.settings')->get('use_admin_theme')) { $paths = array( 'node/*/translate' => TRUE, ); @@ -124,7 +124,7 @@ function translation_permission() { * Implements hook_node_create_access(). */ function translation_node_create_access($account) { - $query = Drupal::request()->query; + $query = \Drupal::request()->query; $translation = $query->get('translation'); $target = $query->get('target'); $request_has_translation_arg = !empty($translation) && !empty($target) && is_numeric($translation); @@ -152,7 +152,7 @@ function translation_node_create_access($account) { function translation_user_can_translate_node($node, $account = NULL) { // If no user object is supplied, the access check is for the current user. if (empty($account)) { - $account = Drupal::currentUser(); + $account = \Drupal::currentUser(); } return node_access('view', $node, $account) && (user_access('translate all content', $account) || ($node->getAuthorId() == $account->id() && user_access('translate own content', $account))); } @@ -276,7 +276,7 @@ function translation_node_view(EntityInterface $node, EntityDisplay $display, $v // only for configurable language types and interface language is the only // configurable language type in core, we use it as default. Contributed // modules can change this behavior by setting the system variable below. - $type = Drupal::config('translation.settings')->get('language_type'); + $type = \Drupal::config('translation.settings')->get('language_type'); $custom_links = language_negotiation_get_switch_links($type, 'node/' . $node->id()); $links = array(); @@ -319,7 +319,7 @@ function translation_node_view(EntityInterface $node, EntityDisplay $display, $v * Implements hook_node_prepare_form(). */ function translation_node_prepare_form(NodeInterface $node, $form_display, $operation, array &$form_state) { - $query = Drupal::request()->query; + $query = \Drupal::request()->query; $translation = $query->get('translation'); $target = $query->get('target'); // Only act if we are dealing with a content type supporting translations. @@ -555,7 +555,7 @@ function translation_path_get_translations($path) { * Replaces links with pointers to translated versions of the content. */ function translation_language_switch_links_alter(array &$links, $type, $path) { - $language_type = Drupal::config('translation.settings')->get('language_type'); + $language_type = \Drupal::config('translation.settings')->get('language_type'); if ($type == $language_type && preg_match("!^node/(\d+)(/.+|)!", $path, $matches)) { $node = node_load((int) $matches[1]); @@ -594,7 +594,7 @@ function translation_language_switch_links_alter(array &$links, $type, $path) { function translation_library_info() { $libraries['drupal.translation'] = array( 'title' => 'Translation', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( drupal_get_path('module', 'translation') . '/translation.js' => array(), ), diff --git a/core/modules/translation/translation.pages.inc b/core/modules/translation/translation.pages.inc index b5ec442..4fff31d 100644 --- a/core/modules/translation/translation.pages.inc +++ b/core/modules/translation/translation.pages.inc @@ -33,7 +33,7 @@ function translation_node_overview(EntityInterface $node) { $translations = array($node->language()->id => $node); } - $type = Drupal::config('translation.settings')->get('language_type'); + $type = \Drupal::config('translation.settings')->get('language_type'); $header = array(t('Language'), t('Title'), t('Status'), t('Operations')); foreach (language_list() as $langcode => $language) { diff --git a/core/modules/update/tests/modules/update_test/update_test.module b/core/modules/update/tests/modules/update_test/update_test.module index eef4c67..7898dba 100644 --- a/core/modules/update/tests/modules/update_test/update_test.module +++ b/core/modules/update/tests/modules/update_test/update_test.module @@ -45,7 +45,7 @@ function update_test_menu() { * just for that module or theme. */ function update_test_system_info_alter(&$info, $file) { - $setting = Drupal::config('update_test.settings')->get('system_info'); + $setting = \Drupal::config('update_test.settings')->get('system_info'); foreach (array('#all', $file->name) as $id) { if (!empty($setting[$id])) { foreach ($setting[$id] as $key => $value) { @@ -67,7 +67,7 @@ function update_test_system_info_alter(&$info, $file) { * module or theme. */ function update_test_update_status_alter(&$projects) { - $setting = Drupal::config('update_test.settings')->get('update_status'); + $setting = \Drupal::config('update_test.settings')->get('update_status'); if (!empty($setting)) { foreach ($projects as $project_name => &$project) { foreach (array('#all', $project_name) as $id) { @@ -103,7 +103,7 @@ function update_test_update_status_alter(&$projects) { * @see update_test_menu() */ function update_test_mock_page($project_name) { - $xml_map = Drupal::config('update_test.settings')->get('xml_map'); + $xml_map = \Drupal::config('update_test.settings')->get('xml_map'); if (isset($xml_map[$project_name])) { $availability_scenario = $xml_map[$project_name]; } diff --git a/core/modules/update/update.api.php b/core/modules/update/update.api.php index ce8234c..b5c8120 100644 --- a/core/modules/update/update.api.php +++ b/core/modules/update/update.api.php @@ -83,7 +83,7 @@ function hook_update_projects_alter(&$projects) { * @see update_calculate_project_data() */ function hook_update_status_alter(&$projects) { - $settings = Drupal::config('update_advanced.settings')->get('projects'); + $settings = \Drupal::config('update_advanced.settings')->get('projects'); foreach ($projects as $project => $project_info) { if (isset($settings[$project]) && isset($settings[$project]['check']) && ($settings[$project]['check'] == 'never' || diff --git a/core/modules/update/update.authorize.inc b/core/modules/update/update.authorize.inc index ab5f5bc..9245fa1 100644 --- a/core/modules/update/update.authorize.inc +++ b/core/modules/update/update.authorize.inc @@ -191,7 +191,7 @@ function update_authorize_update_batch_finished($success, $results) { $success = FALSE; } } - $offline = Drupal::state()->get('system.maintenance_mode'); + $offline = \Drupal::state()->get('system.maintenance_mode'); if ($success) { // Now that the update completed, we need to clear the available update data // and recompute our status, so prevent show bogus results. @@ -199,7 +199,7 @@ function update_authorize_update_batch_finished($success, $results) { // Take the site out of maintenance mode if it was previously that way. if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) { - Drupal::state()->set('system.maintenance_mode', FALSE); + \Drupal::state()->set('system.maintenance_mode', FALSE); $page_message = array( 'message' => t('Update was completed successfully. Your site has been taken out of maintenance mode.'), 'type' => 'status', @@ -258,11 +258,11 @@ function update_authorize_install_batch_finished($success, $results) { $success = FALSE; } } - $offline = Drupal::state()->get('system.maintenance_mode'); + $offline = \Drupal::state()->get('system.maintenance_mode'); if ($success) { // Take the site out of maintenance mode if it was previously that way. if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) { - Drupal::state()->set('system.maintenance_mode', FALSE); + \Drupal::state()->set('system.maintenance_mode', FALSE); $page_message = array( 'message' => t('Installation was completed successfully. Your site has been taken out of maintenance mode.'), 'type' => 'status', @@ -328,6 +328,6 @@ function _update_batch_create_message(&$project_results, $message, $success = TR * @see update_storage_clear() */ function _update_authorize_clear_update_status() { - Drupal::keyValueExpirable('update')->deleteAll(); - Drupal::keyValueExpirable('update_available_release')->deleteAll(); + \Drupal::keyValueExpirable('update')->deleteAll(); + \Drupal::keyValueExpirable('update_available_release')->deleteAll(); } diff --git a/core/modules/update/update.compare.inc b/core/modules/update/update.compare.inc index 3c0422d..15446a3 100644 --- a/core/modules/update/update.compare.inc +++ b/core/modules/update/update.compare.inc @@ -66,14 +66,14 @@ function update_get_projects() { $project_info = new ProjectInfo(); $project_info->processInfoList($projects, $module_data, 'module', TRUE); $project_info->processInfoList($projects, $theme_data, 'theme', TRUE); - if (Drupal::config('update.settings')->get('check.disabled_extensions')) { + if (\Drupal::config('update.settings')->get('check.disabled_extensions')) { $project_info->processInfoList($projects, $module_data, 'module', FALSE); $project_info->processInfoList($projects, $theme_data, 'theme', FALSE); } // Allow other modules to alter projects before fetching and comparing. drupal_alter('update_projects', $projects); // Store the site's project data for at most 1 hour. - Drupal::keyValueExpirable('update')->setWithExpire('update_project_projects', $projects, 3600); + \Drupal::keyValueExpirable('update')->setWithExpire('update_project_projects', $projects, 3600); } } return $projects; @@ -178,7 +178,7 @@ function update_calculate_project_data($available) { drupal_alter('update_status', $projects); // Store the site's update status for at most 1 hour. - Drupal::keyValueExpirable('update')->setWithExpire('update_project_data', $projects, 3600); + \Drupal::keyValueExpirable('update')->setWithExpire('update_project_data', $projects, 3600); return $projects; } @@ -611,10 +611,10 @@ function update_project_storage($key) { 'admin/reports/updates/check', ); if (in_array(current_path(), $paths)) { - Drupal::keyValueExpirable('update')->delete($key); + \Drupal::keyValueExpirable('update')->delete($key); } else { - $projects = Drupal::keyValueExpirable('update')->get($key); + $projects = \Drupal::keyValueExpirable('update')->get($key); } return $projects; } diff --git a/core/modules/update/update.fetch.inc b/core/modules/update/update.fetch.inc index e84c691..6cb7cb7 100644 --- a/core/modules/update/update.fetch.inc +++ b/core/modules/update/update.fetch.inc @@ -38,7 +38,7 @@ function update_manual_status() { * Reference to an array used for Batch API storage. */ function update_fetch_data_batch(&$context) { - $queue = Drupal::queue('update_fetch_tasks'); + $queue = \Drupal::queue('update_fetch_tasks'); if (empty($context['sandbox']['max'])) { $context['finished'] = 0; $context['sandbox']['max'] = $queue->numberOfItems(); @@ -109,8 +109,8 @@ function update_fetch_data_finished($success, $results) { * Attempts to drain the queue of tasks for release history data to fetch. */ function _update_fetch_data() { - $queue = Drupal::queue('update_fetch_tasks'); - $end = time() + Drupal::config('update.settings')->get('fetch.timeout'); + $queue = \Drupal::queue('update_fetch_tasks'); + $end = time() + \Drupal::config('update.settings')->get('fetch.timeout'); while (time() < $end && ($item = $queue->claimItem())) { _update_process_fetch_task($item->data); $queue->deleteItem($item); @@ -131,7 +131,7 @@ function _update_fetch_data() { */ function _update_process_fetch_task($project) { global $base_url; - $update_config = Drupal::config('update.settings'); + $update_config = \Drupal::config('update.settings'); $fail = &drupal_static(__FUNCTION__, array()); // This can be in the middle of a long-running batch, so REQUEST_TIME won't // necessarily be valid. @@ -139,7 +139,7 @@ function _update_process_fetch_task($project) { if (empty($fail)) { // If we have valid data about release history XML servers that we have // failed to fetch from on previous attempts, load that. - $fail = Drupal::keyValueExpirable('update')->get('fetch_failures'); + $fail = \Drupal::keyValueExpirable('update')->get('fetch_failures'); } $max_fetch_attempts = $update_config->get('fetch.max_attempts'); @@ -153,7 +153,7 @@ function _update_process_fetch_task($project) { if (empty($fail[$fetch_url_base]) || $fail[$fetch_url_base] < $max_fetch_attempts) { try { - $data = Drupal::httpClient() + $data = \Drupal::httpClient() ->get($url, array('Accept' => 'text/xml')) ->send() ->getBody(TRUE); @@ -183,17 +183,17 @@ function _update_process_fetch_task($project) { $frequency = $update_config->get('check.interval_days'); $available['last_fetch'] = REQUEST_TIME + $request_time_difference; - Drupal::keyValueExpirable('update_available_releases')->setWithExpire($project_name, $available, $request_time_difference + (60 * 60 * 24 * $frequency)); + \Drupal::keyValueExpirable('update_available_releases')->setWithExpire($project_name, $available, $request_time_difference + (60 * 60 * 24 * $frequency)); // Stash the $fail data back in the DB for the next 5 minutes. - Drupal::keyValueExpirable('update')->setWithExpire('fetch_failures', $fail, $request_time_difference + (60 * 5)); + \Drupal::keyValueExpirable('update')->setWithExpire('fetch_failures', $fail, $request_time_difference + (60 * 5)); // Whether this worked or not, we did just (try to) check for updates. - Drupal::state()->set('update.last_check', REQUEST_TIME + $request_time_difference); + \Drupal::state()->set('update.last_check', REQUEST_TIME + $request_time_difference); // Now that we processed the fetch task for this project, clear out the // record for this task so we're willing to fetch again. - Drupal::keyValue('update_fetch_task')->delete($project_name); + \Drupal::keyValue('update_fetch_task')->delete($project_name); return $success; } @@ -210,15 +210,15 @@ function _update_refresh() { // since that data (even if it's stale) can be useful during // update_get_projects(); for example, to modules that implement // hook_system_info_alter() such as cvs_deploy. - Drupal::keyValueExpirable('update')->delete('update_project_projects'); - Drupal::keyValueExpirable('update')->delete('update_project_data'); + \Drupal::keyValueExpirable('update')->delete('update_project_projects'); + \Drupal::keyValueExpirable('update')->delete('update_project_data'); $projects = update_get_projects(); // Now that we have the list of projects, we should also clear the available // release data, since even if we fail to fetch new data, we need to clear // out the stale data at this point. - Drupal::keyValueExpirable('update_available_releases')->deleteAll(); + \Drupal::keyValueExpirable('update_available_releases')->deleteAll(); foreach ($projects as $key => $project) { update_create_fetch_task($project); @@ -245,12 +245,12 @@ function _update_refresh() { function _update_create_fetch_task($project) { $fetch_tasks = &drupal_static(__FUNCTION__, array()); if (empty($fetch_tasks)) { - $fetch_tasks = Drupal::keyValue('update_fetch_task')->getAll(); + $fetch_tasks = \Drupal::keyValue('update_fetch_task')->getAll(); } if (empty($fetch_tasks[$project['name']])) { - $queue = Drupal::queue('update_fetch_tasks'); + $queue = \Drupal::queue('update_fetch_tasks'); $queue->createItem($project); - Drupal::keyValue('update_fetch_task')->set($project['name'], $project); + \Drupal::keyValue('update_fetch_task')->set($project['name'], $project); $fetch_tasks[$project['name']] = REQUEST_TIME; } } @@ -277,7 +277,7 @@ function _update_create_fetch_task($project) { function _update_build_fetch_url($project, $site_key = '') { $name = $project['name']; $url = _update_get_fetch_url_base($project); - $url .= '/' . $name . '/' . Drupal::CORE_COMPATIBILITY; + $url .= '/' . $name . '/' . \Drupal::CORE_COMPATIBILITY; // Only append usage infomation if we have a site key and the project is // enabled. We do not want to record usage statistics for disabled projects. @@ -319,7 +319,7 @@ function _update_get_fetch_url_base($project) { $url = $project['info']['project status url']; } else { - $url = Drupal::config('update.settings')->get('fetch.url'); + $url = \Drupal::config('update.settings')->get('fetch.url'); if (empty($url)) { $url = UPDATE_DEFAULT_URL; } @@ -337,7 +337,7 @@ function _update_get_fetch_url_base($project) { * @see update_requirements() */ function _update_cron_notify() { - $update_config = Drupal::config('update.settings'); + $update_config = \Drupal::config('update.settings'); module_load_install('update'); $status = update_requirements('runtime'); $params = array(); @@ -364,7 +364,7 @@ function _update_cron_notify() { // Track when the last mail was successfully sent to avoid sending // too many e-mails. if ($message['result']) { - Drupal::state()->set('update.last_email_notification', REQUEST_TIME); + \Drupal::state()->set('update.last_email_notification', REQUEST_TIME); } } } diff --git a/core/modules/update/update.install b/core/modules/update/update.install index 3037c84..505b1ca 100644 --- a/core/modules/update/update.install +++ b/core/modules/update/update.install @@ -60,7 +60,7 @@ function update_requirements($phase) { * Implements hook_install(). */ function update_install() { - $queue = Drupal::queue('update_fetch_tasks', TRUE); + $queue = \Drupal::queue('update_fetch_tasks', TRUE); $queue->createQueue(); } @@ -72,7 +72,7 @@ function update_uninstall() { variable_del('update_last_check'); variable_del('update_last_email_notification'); - $queue = Drupal::queue('update_fetch_tasks'); + $queue = \Drupal::queue('update_fetch_tasks'); $queue->deleteQueue(); } diff --git a/core/modules/update/update.manager.inc b/core/modules/update/update.manager.inc index a5e8652..a1eccb9 100644 --- a/core/modules/update/update.manager.inc +++ b/core/modules/update/update.manager.inc @@ -285,7 +285,7 @@ function update_manager_update_form($form, $form_state = array(), $context) { */ function theme_update_manager_update_form($variables) { $form = $variables['form']; - $last = Drupal::state()->get('update.last_check') ?: 0; + $last = \Drupal::state()->get('update.last_check') ?: 0; $update_last_check = array( '#theme' => 'update_last_check', '#last' => $last, @@ -435,9 +435,9 @@ function update_manager_update_ready_form($form, &$form_state) { */ function update_manager_update_ready_form_submit($form, &$form_state) { // Store maintenance_mode setting so we can restore it when done. - $_SESSION['maintenance_mode'] = Drupal::state()->get('system.maintenance_mode'); + $_SESSION['maintenance_mode'] = \Drupal::state()->get('system.maintenance_mode'); if ($form_state['values']['maintenance_mode'] == TRUE) { - Drupal::state()->set('system.maintenance_mode', TRUE); + \Drupal::state()->set('system.maintenance_mode', TRUE); } if (!empty($_SESSION['update_manager_update_projects'])) { @@ -821,7 +821,7 @@ function update_manager_archive_extract($file, $directory) { * are no errors, it will be an empty array. */ function update_manager_archive_verify($project, $archive_file, $directory) { - return Drupal::moduleHandler()->invokeAll('verify_update_archive', array($project, $archive_file, $directory)); + return \Drupal::moduleHandler()->invokeAll('verify_update_archive', array($project, $archive_file, $directory)); } /** diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 0ab4d9d..4e7626b 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -281,10 +281,10 @@ function update_theme() { * Implements hook_cron(). */ function update_cron() { - $update_config = Drupal::config('update.settings'); + $update_config = \Drupal::config('update.settings'); $frequency = $update_config->get('check.interval_days'); $interval = 60 * 60 * 24 * $frequency; - $last_check = Drupal::state()->get('update.last_check') ?: 0; + $last_check = \Drupal::state()->get('update.last_check') ?: 0; if ((REQUEST_TIME - $last_check) > $interval) { // If the configured update interval has elapsed, we want to invalidate // the data for all projects, attempt to re-fetch, and trigger any @@ -297,7 +297,7 @@ function update_cron() { // missing data, and if so, try to fetch the data. update_get_available(TRUE); } - $last_email_notice = Drupal::state()->get('update.last_email_notification') ?: 0; + $last_email_notice = \Drupal::state()->get('update.last_email_notification') ?: 0; if ((REQUEST_TIME - $last_email_notice) > $interval) { // If configured time between notifications elapsed, send email about // updates possibly available. @@ -388,7 +388,7 @@ function update_get_available($refresh = FALSE) { $needs_refresh = FALSE; // Grab whatever data we currently have. - $available = Drupal::keyValueExpirable('update_available_releases')->getAll(); + $available = \Drupal::keyValueExpirable('update_available_releases')->getAll(); $projects = update_get_projects(); foreach ($projects as $key => $project) { @@ -427,7 +427,7 @@ function update_get_available($refresh = FALSE) { update_fetch_data(); // After processing the queue, we've (hopefully) got better data, so pull // the latest data again and use that directly. - $available = Drupal::keyValueExpirable('update_available_releases')->getAll(); + $available = \Drupal::keyValueExpirable('update_available_releases')->getAll(); } return $available; @@ -489,7 +489,7 @@ function update_fetch_data() { function update_mail($key, &$message, $params) { $langcode = $message['langcode']; $language = language_load($langcode); - $message['subject'] .= t('New release(s) available for !site_name', array('!site_name' => Drupal::config('system.site')->get('name')), array('langcode' => $langcode)); + $message['subject'] .= t('New release(s) available for !site_name', array('!site_name' => \Drupal::config('system.site')->get('name')), array('langcode' => $langcode)); foreach ($params as $msg_type => $msg_reason) { $message['body'][] = _update_message_text($msg_type, $msg_reason, FALSE, $langcode); } @@ -498,7 +498,7 @@ function update_mail($key, &$message, $params) { $message['body'][] = t('You can automatically install your missing updates using the Update manager:', array(), array('langcode' => $langcode)) . "\n" . url('admin/reports/updates/update', array('absolute' => TRUE, 'language' => $language)); } $settings_url = url('admin/reports/updates/settings', array('absolute' => TRUE)); - if (Drupal::config('update.settings')->get('notification.threshold') == 'all') { + if (\Drupal::config('update.settings')->get('notification.threshold') == 'all') { $message['body'][] = t('Your site is currently configured to send these emails when any updates are available. To get notified only for security updates, !url.', array('!url' => $settings_url)); } else { @@ -677,7 +677,7 @@ function update_verify_update_archive($project, $archive_file, $directory) { $info = drupal_parse_info_file($file->uri); // If the module or theme is incompatible with Drupal core, set an error. - if (empty($info['core']) || $info['core'] != Drupal::CORE_COMPATIBILITY) { + if (empty($info['core']) || $info['core'] != \Drupal::CORE_COMPATIBILITY) { $incompatible[] = !empty($info['name']) ? $info['name'] : t('Unknown'); } else { @@ -694,7 +694,7 @@ function update_verify_update_archive($project, $archive_file, $directory) { count($incompatible), '%archive_file contains a version of %names that is not compatible with Drupal !version.', '%archive_file contains versions of modules or themes that are not compatible with Drupal !version: %names', - array('!version' => Drupal::CORE_COMPATIBILITY, '%archive_file' => drupal_basename($archive_file), '%names' => implode(', ', $incompatible)) + array('!version' => \Drupal::CORE_COMPATIBILITY, '%archive_file' => drupal_basename($archive_file), '%names' => implode(', ', $incompatible)) ); } @@ -705,8 +705,8 @@ function update_verify_update_archive($project, $archive_file, $directory) { * Invalidates stored data relating to update status. */ function update_storage_clear() { - Drupal::keyValueExpirable('update')->deleteAll(); - Drupal::keyValueExpirable('update_available_release')->deleteAll(); + \Drupal::keyValueExpirable('update')->deleteAll(); + \Drupal::keyValueExpirable('update_available_release')->deleteAll(); } /** diff --git a/core/modules/update/update.report.inc b/core/modules/update/update.report.inc index 1ce4f7c..4c5264e 100644 --- a/core/modules/update/update.report.inc +++ b/core/modules/update/update.report.inc @@ -17,7 +17,7 @@ function theme_update_report($variables) { $data = $variables['data']; - $last = Drupal::state()->get('update.last_check') ?: 0; + $last = \Drupal::state()->get('update.last_check') ?: 0; $update_last_check = array( '#theme' => 'update_last_check', '#last' => $last, @@ -32,7 +32,7 @@ function theme_update_report($variables) { $header = array(); $rows = array(); - $notification_level = Drupal::config('update.settings')->get('notification.threshold'); + $notification_level = \Drupal::config('update.settings')->get('notification.threshold'); // Create an array of status values keyed by module or theme name, since // we'll need this while generating the report if we have to cross reference diff --git a/core/modules/user/user.api.php b/core/modules/user/user.api.php index b7f8b8c..5c66c0a 100644 --- a/core/modules/user/user.api.php +++ b/core/modules/user/user.api.php @@ -283,7 +283,7 @@ function hook_user_update($account) { * The user object on which the operation was just performed. */ function hook_user_login($account) { - $config = Drupal::config('system.date'); + $config = \Drupal::config('system.date'); // If the user has a NULL time zone, notify them to set a time zone. if (!$account->getTimezone() && $config->get('timezone.user.configurable') && $config->get('timezone.user.warn')) { drupal_set_message(t('Configure your account time zone setting.', array('@user-edit' => url("user/" . $account->id() . "/edit", array('query' => drupal_get_destination(), 'fragment' => 'edit-timezone'))))); diff --git a/core/modules/user/user.install b/core/modules/user/user.install index 2d5b03e..ef7d378 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -495,7 +495,7 @@ function user_update_8004() { '2' => 'visitors_admin_approval', ); - $config = Drupal::config('user.settings'); + $config = \Drupal::config('user.settings'); $user_register = $config->get('register'); $user_cancel_method = $config->get('cancel_method'); @@ -1045,7 +1045,7 @@ function user_update_8018() { ->fetchAll(); foreach ($roles as $role) { - Drupal::config('user.role.' . $role->rid) + \Drupal::config('user.role.' . $role->rid) ->set('id', $role->rid) ->set('uuid', $uuid->generate()) ->set('label', $role->name) @@ -1128,7 +1128,7 @@ function user_update_8020() { } } foreach ($new_permissions as $rid => $permissions) { - Drupal::config("user.role.$rid") + \Drupal::config("user.role.$rid") ->set('permissions', $permissions) ->save(); } @@ -1140,7 +1140,7 @@ function user_update_8020() { function user_update_8021() { $uuid = new Uuid(); - Drupal::config("entity.form_mode.user.register") + \Drupal::config("entity.form_mode.user.register") ->set('id', "user.register") ->set('uuid', $uuid->generate()) ->set('label', 'Register') diff --git a/core/modules/user/user.module b/core/modules/user/user.module index fe32089..d800f6a 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -214,7 +214,7 @@ function user_field_extra_fields() { 'description' => t('User module account form elements.'), 'weight' => -10, ); - if (Drupal::config('user.settings')->get('signatures')) { + if (\Drupal::config('user.settings')->get('signatures')) { $fields['user']['user']['form']['signature_settings'] = array( 'label' => t('Signature settings'), 'description' => t('User module form element.'), @@ -226,7 +226,7 @@ function user_field_extra_fields() { 'description' => t('User module form element.'), 'weight' => 0, ); - if (Drupal::config('system.date')->get('timezone.user.configurable')) { + if (\Drupal::config('system.date')->get('timezone.user.configurable')) { $fields['user']['user']['form']['timezone'] = array( 'label' => t('Timezone'), 'description' => t('System module form element.'), @@ -418,7 +418,7 @@ function user_role_permissions(array $roles) { function _user_role_permissions_update($roles) { $role_permissions = array(); foreach ($roles as $rid) { - $role_permissions[$rid] = Drupal::config("user.role.$rid")->get('permissions') ?: array(); + $role_permissions[$rid] = \Drupal::config("user.role.$rid")->get('permissions') ?: array(); } return $role_permissions; } @@ -443,7 +443,7 @@ function user_access($string, AccountInterface $account = NULL) { if (!isset($account)) { // In the installer request session is not set, so we have to fall back // to the global $user. In all other cases the session key is preferred. - $account = Drupal::request()->attributes->get('_account') ?: $user; + $account = \Drupal::request()->attributes->get('_account') ?: $user; } return $account->hasPermission($string); @@ -493,7 +493,7 @@ function user_permission() { ), 'cancel account' => array( 'title' => t('Cancel own user account'), - 'description' => t('Note: content may be kept, unpublished, deleted or transferred to the %anonymous-name user depending on the configured user settings.', array('%anonymous-name' => Drupal::config('user.settings')->get('anonymous'), '@user-settings-url' => url('admin/config/people/accounts'))), + 'description' => t('Note: content may be kept, unpublished, deleted or transferred to the %anonymous-name user depending on the configured user settings.', array('%anonymous-name' => \Drupal::config('user.settings')->get('anonymous'), '@user-settings-url' => url('admin/config/people/accounts'))), ), 'select account cancellation method' => array( 'title' => t('Select method for cancelling own account'), @@ -539,7 +539,7 @@ function user_validate_current_pass(&$form, &$form_state) { // that prevent them from being empty if they are changed. $current_value = $account->getPropertyDefinition($key) ? $account->get($key)->value : $account->$key; if ((strlen(trim($form_state['values'][$key])) > 0) && ($form_state['values'][$key] != $current_value)) { - $current_pass_failed = empty($form_state['values']['current_pass']) || !Drupal::service('password')->check($form_state['values']['current_pass'], $account); + $current_pass_failed = empty($form_state['values']['current_pass']) || !\Drupal::service('password')->check($form_state['values']['current_pass'], $account); if ($current_pass_failed) { form_set_error('current_pass', t("Your current password is missing or incorrect; it's required to change the %name.", array('%name' => $name))); form_set_error($key); @@ -722,7 +722,7 @@ function user_is_logged_in() { * TRUE if the user is not already logged in and can register for an account. */ function user_register_access() { - return user_is_anonymous() && (Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY); + return user_is_anonymous() && (\Drupal::config('user.settings')->get('register') != USER_REGISTER_ADMINISTRATORS_ONLY); } /** @@ -1023,7 +1023,7 @@ function user_authenticate($name, $password) { if (!empty($name) && !empty($password)) { $account = user_load_by_name($name); if ($account) { - $password_hasher = Drupal::service('password'); + $password_hasher = \Drupal::service('password'); if ($password_hasher->check($password, $account)) { // Successful authentication. $uid = $account->id(); @@ -1070,7 +1070,7 @@ function user_login_finalize(UserInterface $account) { // or incorrectly does a redirect which would leave the old session in place. drupal_session_regenerate(); - Drupal::moduleHandler()->invokeAll('user_login', array($user)); + \Drupal::moduleHandler()->invokeAll('user_login', array($user)); } /** @@ -1207,7 +1207,7 @@ function user_cancel($edit, $uid, $method) { // should use those hooks to respond to the account deletion. if ($method != 'user_cancel_delete') { // Allow modules to add further sets to this batch. - Drupal::moduleHandler()->invokeAll('user_cancel', array($edit, $account, $method)); + \Drupal::moduleHandler()->invokeAll('user_cancel', array($edit, $account, $method)); } // Finish the batch and actually cancel the account. @@ -1303,7 +1303,7 @@ function _user_cancel_session_regenerate() { * @see user_admin_settings() */ function user_cancel_methods() { - $user_settings = Drupal::config('user.settings'); + $user_settings = \Drupal::config('user.settings'); $anonymous_name = $user_settings->get('anonymous'); $methods = array( 'user_cancel_block' => array( @@ -1321,11 +1321,11 @@ function user_cancel_methods() { 'user_cancel_delete' => array( 'title' => t('Delete the account and its content.'), 'description' => t('Your account will be removed and all account information deleted. All of your content will also be deleted.'), - 'access' => Drupal::request()->attributes->get('_account')->hasPermission('administer users'), + 'access' => \Drupal::request()->attributes->get('_account')->hasPermission('administer users'), ), ); // Allow modules to customize account cancellation methods. - Drupal::moduleHandler()->alter('user_cancel_methods', $methods); + \Drupal::moduleHandler()->alter('user_cancel_methods', $methods); // Turn all methods into real form elements. $form = array( @@ -1432,7 +1432,7 @@ function user_view_multiple($accounts, $view_mode = 'full', $langcode = NULL) { * Implements hook_mail(). */ function user_mail($key, &$message, $params) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $langcode = $message['langcode']; $variables = array('user' => $params['account']); @@ -1442,7 +1442,7 @@ function user_mail($key, &$message, $params) { // the locale module is enabled. $user_config_context = config_context_enter('Drupal\user\UserConfigContext'); $user_config_context->setAccount($params['account']); - $mail_config = Drupal::config('user.mail'); + $mail_config = \Drupal::config('user.mail'); // We do not sanitize the token replacement, since the output of this // replacement is intended for an e-mail message, not a web browser. @@ -1615,7 +1615,7 @@ function user_role_load($rid) { */ function user_permission_get_modules() { $permissions = array(); - foreach (Drupal::moduleHandler()->getImplementations('permission') as $module) { + foreach (\Drupal::moduleHandler()->getImplementations('permission') as $module) { $perms = module_invoke($module, 'permission'); foreach ($perms as $key => $value) { $permissions[$key] = $module; @@ -1762,17 +1762,17 @@ function theme_user_signature($variables) { */ function _user_mail_notify($op, $account, $langcode = NULL) { // By default, we always notify except for canceled and blocked. - $notify = Drupal::config('user.settings')->get('notify.' . $op); + $notify = \Drupal::config('user.settings')->get('notify.' . $op); if ($notify || ($op != 'status_canceled' && $op != 'status_blocked')) { $params['account'] = $account; $langcode = $langcode ? $langcode : $account->getPreferredLangcode(); // Get the custom site notification email to use as the from email address // if it has been set. - $site_mail = Drupal::config('system.site')->get('mail_notification'); + $site_mail = \Drupal::config('system.site')->get('mail_notification'); // If the custom site notification email has not been set, we use the site // default for this. if (empty($site_mail)) { - $site_mail = Drupal::config('system.site')->get('mail'); + $site_mail = \Drupal::config('system.site')->get('mail'); } if (empty($site_mail)) { $site_mail = ini_get('sendmail_from'); @@ -1804,7 +1804,7 @@ function user_form_process_password_confirm($element) { 'showStrengthIndicator' => FALSE, ); - if (Drupal::config('user.settings')->get('password_strength')) { + if (\Drupal::config('user.settings')->get('password_strength')) { global $user; $password_settings['showStrengthIndicator'] = TRUE; @@ -1868,7 +1868,7 @@ function user_node_load($nodes, $types) { */ function user_modules_installed($modules) { // Assign all available permissions to the administrator role. - $rid = Drupal::config('user.settings')->get('admin_role'); + $rid = \Drupal::config('user.settings')->get('admin_role'); if ($rid) { $permissions = array(); foreach ($modules as $module) { @@ -1887,7 +1887,7 @@ function user_modules_installed($modules) { */ function user_modules_uninstalled($modules) { // Remove any potentially orphan module data stored for users. - Drupal::service('user.data')->delete($modules); + \Drupal::service('user.data')->delete($modules); } /** @@ -2003,7 +2003,7 @@ function user_library_info() { $path = drupal_get_path('module', 'user'); $libraries['drupal.user'] = array( 'title' => 'User', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/user.js' => array(), ), @@ -2019,7 +2019,7 @@ function user_library_info() { $libraries['drupal.user.permissions'] = array( 'title' => 'User permissions', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . '/user.permissions.js' => array(), ), @@ -2032,7 +2032,7 @@ function user_library_info() { $libraries['drupal.user.icons'] = array( 'title' => 'User icon styling', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'css' => array( $path . '/css/user.icons.css' => array(), ), @@ -2049,7 +2049,7 @@ function user_logout() { watchdog('user', 'Session closed for %name.', array('%name' => $user->getUsername())); - Drupal::moduleHandler()->invokeAll('user_logout', array($user)); + \Drupal::moduleHandler()->invokeAll('user_logout', array($user)); // Destroy the current session, and reset $user to the anonymous user. session_destroy(); diff --git a/core/modules/user/user.pages.inc b/core/modules/user/user.pages.inc index a9cf426..6e4f999 100644 --- a/core/modules/user/user.pages.inc +++ b/core/modules/user/user.pages.inc @@ -39,7 +39,7 @@ function user_pass_reset($form, &$form_state, $uid, $timestamp, $hashed_pass, $a } else { // Time out, in seconds, until login URL expires. - $timeout = Drupal::config('user.settings')->get('password_reset_timeout'); + $timeout = \Drupal::config('user.settings')->get('password_reset_timeout'); $current = REQUEST_TIME; $account = user_load($uid); // Verify that the user exists and is active. @@ -130,12 +130,12 @@ function user_cancel_confirm($account, $timestamp = 0, $hashed_pass = '') { $current = REQUEST_TIME; // Basic validation of arguments. - $account_data = Drupal::service('user.data')->get('user', $account->id()); + $account_data = \Drupal::service('user.data')->get('user', $account->id()); if (isset($account_data['cancel_method']) && !empty($timestamp) && !empty($hashed_pass)) { // Validate expiration and hashed password/login. if ($timestamp <= $current && $current - $timestamp < $timeout && $account->id() && $timestamp >= $account->getLastLoginTime() && $hashed_pass == user_pass_rehash($account->getPassword(), $timestamp, $account->getLastLoginTime())) { $edit = array( - 'user_cancel_notify' => isset($account_data['cancel_notify']) ? $account_data['cancel_notify'] : Drupal::config('user.settings')->get('notify.status_canceled'), + 'user_cancel_notify' => isset($account_data['cancel_notify']) ? $account_data['cancel_notify'] : \Drupal::config('user.settings')->get('notify.status_canceled'), ); user_cancel($edit, $account->id(), $account_data['cancel_method']); // Since user_cancel() is not invoked via Form API, batch processing needs diff --git a/core/modules/user/user.tokens.inc b/core/modules/user/user.tokens.inc index 522dec9..5412a38 100644 --- a/core/modules/user/user.tokens.inc +++ b/core/modules/user/user.tokens.inc @@ -63,7 +63,7 @@ function user_token_info() { */ function user_tokens($type, $tokens, array $data = array(), array $options = array()) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $url_options = array('absolute' => TRUE); if (isset($options['langcode'])) { $url_options['language'] = language_load($options['langcode']); diff --git a/core/modules/user/user.views.inc b/core/modules/user/user.views.inc index 710e84b..f49e812 100644 --- a/core/modules/user/user.views.inc +++ b/core/modules/user/user.views.inc @@ -281,7 +281,7 @@ function user_views_data() { ), ); - if (Drupal::moduleHandler()->moduleExists('content_translation')) { + if (\Drupal::moduleHandler()->moduleExists('content_translation')) { $data['users']['translation_link'] = array( 'title' => t('Translation link'), 'help' => t('Provide a link to the translations overview for users.'), diff --git a/core/modules/views/tests/modules/views_test_data/views_test_data.install b/core/modules/views/tests/modules/views_test_data/views_test_data.install index f01f410..8cd7f38 100644 --- a/core/modules/views/tests/modules/views_test_data/views_test_data.install +++ b/core/modules/views/tests/modules/views_test_data/views_test_data.install @@ -9,7 +9,7 @@ * Implements hook_schema(). */ function views_test_data_schema() { - return Drupal::state()->get('views_test_data_schema'); + return \Drupal::state()->get('views_test_data_schema'); } /** @@ -31,5 +31,5 @@ function views_test_data_install() { 'em' => 'EM', 'marquee' => 'MARQUEE' ); - Drupal::config('views.settings')->set('field_rewrite_elements', $values)->save(); + \Drupal::config('views.settings')->set('field_rewrite_elements', $values)->save(); } diff --git a/core/modules/views/tests/modules/views_test_data/views_test_data.module b/core/modules/views/tests/modules/views_test_data/views_test_data.module index e5dc45e..4dd8fa2 100644 --- a/core/modules/views/tests/modules/views_test_data/views_test_data.module +++ b/core/modules/views/tests/modules/views_test_data/views_test_data.module @@ -29,7 +29,7 @@ function views_test_data_permission() { * @see Drupal\views\Tests\Handler\HandlerTest */ function views_test_data_handler_test_access_callback() { - return Drupal::config('views_test_data.tests')->get('handler_access_callback'); + return \Drupal::config('views_test_data.tests')->get('handler_access_callback'); } /** @@ -48,7 +48,7 @@ function views_test_data_handler_test_access_callback_argument($argument = FALSE // Check the argument to be sure that access arguments are passed into the // callback. if ($argument) { - return Drupal::config('views_test_data.tests')->get('handler_access_callback_argument'); + return \Drupal::config('views_test_data.tests')->get('handler_access_callback_argument'); } else { return FALSE; @@ -60,9 +60,9 @@ function views_test_data_handler_test_access_callback_argument($argument = FALSE */ function views_test_data_preprocess_views_view_table(&$variables) { if ($variables['view']->storage->id() == 'test_view_render') { - $views_render_test = Drupal::state()->get('views_render.test'); + $views_render_test = \Drupal::state()->get('views_render.test'); $views_render_test++; - Drupal::state()->set('views_render.test', $views_render_test); + \Drupal::state()->set('views_render.test', $views_render_test); } } diff --git a/core/modules/views/tests/modules/views_test_data/views_test_data.views.inc b/core/modules/views/tests/modules/views_test_data/views_test_data.views.inc index ad5b23f..4fe1fe4 100644 --- a/core/modules/views/tests/modules/views_test_data/views_test_data.views.inc +++ b/core/modules/views/tests/modules/views_test_data/views_test_data.views.inc @@ -12,7 +12,7 @@ * Implements hook_views_data(). */ function views_test_data_views_data() { - $state = Drupal::service('state'); + $state = \Drupal::service('state'); $state->set('views_hook_test_views_data', TRUE); // We use a state variable to keep track of how many times this function is // called so we can assert that calls to @@ -30,14 +30,14 @@ function views_test_data_views_data() { * Implements hook_views_data_alter(). */ function views_test_data_views_data_alter() { - Drupal::state()->set('views_hook_test_views_data_alter', TRUE); + \Drupal::state()->set('views_hook_test_views_data_alter', TRUE); } /** * Implements hook_views_analyze(). */ function views_test_data_views_analyze(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_analyze', TRUE); + \Drupal::state()->set('views_hook_test_views_analyze', TRUE); $ret = array(); @@ -52,5 +52,5 @@ function views_test_data_views_analyze(ViewExecutable $view) { * Implements hook_views_invalidate_cache(). */ function views_test_data_views_invalidate_cache() { - Drupal::state()->set('views_hook_test_views_invalidate_cache', TRUE); + \Drupal::state()->set('views_hook_test_views_invalidate_cache', TRUE); } diff --git a/core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc b/core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc index e5a4277..5e77853 100644 --- a/core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc +++ b/core/modules/views/tests/modules/views_test_data/views_test_data.views_execution.inc @@ -12,28 +12,28 @@ * Implements hook_views_query_substitutions(). */ function views_test_data_views_query_substitutions(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_query_substitutions', TRUE); + \Drupal::state()->set('views_hook_test_views_query_substitutions', TRUE); } /** * Implements hook_views_form_substitutions(). */ function views_test_data_views_form_substitutions(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_form_substitutions', TRUE); + \Drupal::state()->set('views_hook_test_views_form_substitutions', TRUE); } /** * Implements hook_field_views_data(). */ function views_test_data_field_views_data($field) { - Drupal::state()->set('views_hook_test_field_views_data', TRUE); + \Drupal::state()->set('views_hook_test_field_views_data', TRUE); } /** * Implements hook_field_views_data_alter(). */ function views_test_data_field_views_data_alter(&$data, $field, $module) { - Drupal::state()->set('views_hook_test_field_views_data_alter', TRUE); + \Drupal::state()->set('views_hook_test_field_views_data_alter', TRUE); } /** @@ -43,7 +43,7 @@ function views_test_data_field_views_data_alter(&$data, $field, $module) { * @see \Drupal\views\Tests\Plugin\RenderTest */ function views_test_data_views_pre_render(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_pre_render', TRUE); + \Drupal::state()->set('views_hook_test_views_pre_render', TRUE); if (isset($view) && ($view->storage->id() == 'test_cache_header_storage')) { $path = drupal_get_path('module', 'views_test_data'); @@ -58,21 +58,21 @@ function views_test_data_views_pre_render(ViewExecutable $view) { * Implements hook_views_post_render(). */ function views_test_data_views_post_render(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_post_render', TRUE); + \Drupal::state()->set('views_hook_test_views_post_render', TRUE); } /** * Implements hook_views_pre_build(). */ function views_test_data_views_pre_build(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_pre_build', TRUE); + \Drupal::state()->set('views_hook_test_views_pre_build', TRUE); } /** * Implements hook_views_post_build(). */ function views_test_data_views_post_build(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_post_build', TRUE); + \Drupal::state()->set('views_hook_test_views_post_build', TRUE); if (isset($view) && ($view->storage->id() == 'test_page_display')) { if ($view->current_display == 'page_1') { @@ -88,26 +88,26 @@ function views_test_data_views_post_build(ViewExecutable $view) { * Implements hook_views_pre_view(). */ function views_test_data_views_pre_view(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_pre_view', TRUE); + \Drupal::state()->set('views_hook_test_views_pre_view', TRUE); } /** * Implements hook_views_pre_execute(). */ function views_test_data_views_pre_execute(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_pre_execute', TRUE); + \Drupal::state()->set('views_hook_test_views_pre_execute', TRUE); } /** * Implements hook_views_post_execute(). */ function views_test_data_views_post_execute(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_post_execute', TRUE); + \Drupal::state()->set('views_hook_test_views_post_execute', TRUE); } /** * Implements hook_views_query_alter(). */ function views_test_data_views_query_alter(ViewExecutable $view) { - Drupal::state()->set('views_hook_test_views_query_alter', TRUE); + \Drupal::state()->set('views_hook_test_views_query_alter', TRUE); } diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php index 261c357..ea2c97c 100644 --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -336,7 +336,7 @@ function hook_views_data_alter(array &$data) { function hook_views_query_substitutions(ViewExecutable $view) { // Example from views_views_query_substitutions(). return array( - '***CURRENT_VERSION***' => Drupal::VERSION, + '***CURRENT_VERSION***' => \Drupal::VERSION, '***CURRENT_TIME***' => REQUEST_TIME, '***CURRENT_LANGUAGE***' => language(\Drupal\Core\Language\Language::TYPE_CONTENT)->id, '***DEFAULT_LANGUAGE***' => language_default()->id, diff --git a/core/modules/views/views.module b/core/modules/views/views.module index 5bc91b2..1bc4bd4 100644 --- a/core/modules/views/views.module +++ b/core/modules/views/views.module @@ -84,7 +84,7 @@ function views_pre_render_view_element($element) { * definitions. */ function views_theme($existing, $type, $theme, $path) { - Drupal::moduleHandler()->loadInclude('views', 'inc', 'views.theme'); + \Drupal::moduleHandler()->loadInclude('views', 'inc', 'views.theme'); // Some quasi clever array merging here. $base = array( @@ -121,7 +121,7 @@ function views_theme($existing, $type, $theme, $path) { ); $plugins = views_get_plugin_definitions(); - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); // Register theme functions for all style plugins. It provides a basic auto // implementation of theme functions or template files by using the plugin @@ -256,7 +256,7 @@ function views_plugin_list() { * node portion of the theme registry. */ function views_preprocess_node(&$variables) { - Drupal::moduleHandler()->loadInclude('node', 'views.inc'); + \Drupal::moduleHandler()->loadInclude('node', 'views.inc'); // The 'view' attribute of the node is added in // \Drupal\views\Plugin\views\row\EntityRow::preRender(). if (!empty($variables['node']->view) && $variables['node']->view->storage->id()) { @@ -685,20 +685,20 @@ function views_invalidate_cache() { Cache::deleteTags(array('content' => TRUE)); // Set the menu as needed to be rebuilt. - Drupal::state()->set('menu_rebuild_needed', TRUE); + \Drupal::state()->set('menu_rebuild_needed', TRUE); - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); // Set the router to be rebuild. // @todo Figure out why the cache rebuild is trigged but the route table // does not exist yet. if (db_table_exists('router')) { - Drupal::service('router.builder')->rebuild(); + \Drupal::service('router.builder')->rebuild(); } // Invalidate the block cache to update views block derivatives. if ($module_handler->moduleExists('block')) { - Drupal::service('plugin.manager.block')->clearCachedDefinitions(); + \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } // Allow modules to respond to the Views cache being cleared. @@ -802,14 +802,14 @@ function views_library_info() { $path = drupal_get_path('module', 'views'); $libraries['views.module'] = array( 'title' => 'Views base', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'css' => array( "$path/css/views.module.css" ), ); $libraries['views.ajax'] = array( 'title' => 'Views AJAX', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( "$path/js/base.js" => array('group' => JS_DEFAULT), "$path/js/ajax_view.js" => array('group' => JS_DEFAULT), @@ -825,7 +825,7 @@ function views_library_info() { ); $libraries['views.contextual-links'] = array( 'title' => 'Views Contextual links', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( // Set to -10 to move it before the contextual links javascript file. "$path/js/views-contextual.js" => array('group' => JS_LIBRARY, 'weight' => -10), @@ -837,7 +837,7 @@ function views_library_info() { ); $libraries['views.exposed-form'] = array( 'title' => 'Views exposed form', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'css' => array( "$path/css/views.exposed_form.css", ), @@ -902,7 +902,7 @@ function views_get_plugin_definitions() { * Get enabled display extenders. */ function views_get_enabled_display_extenders() { - $enabled = array_filter((array) Drupal::config('views.settings')->get('display_extenders')); + $enabled = array_filter((array) \Drupal::config('views.settings')->get('display_extenders')); return drupal_map_assoc($enabled); } @@ -933,13 +933,13 @@ function views_get_applicable_views($type) { } } - $entity_ids = Drupal::service('entity.query')->get('view') + $entity_ids = \Drupal::service('entity.query')->get('view') ->condition('status', TRUE) ->condition("display.*.display_plugin", $ids, 'IN') ->execute(); $result = array(); - foreach (Drupal::entityManager()->getStorageController('view')->loadMultiple($entity_ids) as $view) { + foreach (\Drupal::entityManager()->getStorageController('view')->loadMultiple($entity_ids) as $view) { // Check each display to see if it meets the criteria and is enabled. $executable = $view->getExecutable(); $executable->initDisplay(); @@ -957,14 +957,14 @@ function views_get_applicable_views($type) { * Returns an array of all views as fully loaded $view objects. */ function views_get_all_views() { - return Drupal::entityManager()->getStorageController('view')->loadMultiple(); + return \Drupal::entityManager()->getStorageController('view')->loadMultiple(); } /** * Returns an array of all enabled views, as fully loaded $view objects. */ function views_get_enabled_views() { - $query = Drupal::entityQuery('view') + $query = \Drupal::entityQuery('view') ->condition('status', TRUE) ->execute(); @@ -975,7 +975,7 @@ function views_get_enabled_views() { * Returns an array of all disabled views, as fully loaded $view objects. */ function views_get_disabled_views() { - $query = Drupal::entityQuery('view') + $query = \Drupal::entityQuery('view') ->condition('status', FALSE) ->execute(); @@ -1334,7 +1334,7 @@ function views_pre_render_views_form_views_form($element) { $replace[] = isset($element[$field_name][$row_id]) ? drupal_render($element[$field_name][$row_id]) : ''; } // Add in substitutions from hook_views_form_substitutions(). - $substitutions = Drupal::moduleHandler()->invokeAll('views_form_substitutions'); + $substitutions = \Drupal::moduleHandler()->invokeAll('views_form_substitutions'); foreach ($substitutions as $placeholder => $substitution) { $search[] = $placeholder; $replace[] = $substitution; @@ -1675,7 +1675,7 @@ function views_element_validate_tags($element, &$form_state) { * If TRUE, the data will be cached specific to the currently active language. */ function views_cache_set($cid, $data, $use_language = FALSE) { - if (Drupal::config('views.settings')->get('skip_cache')) { + if (\Drupal::config('views.settings')->get('skip_cache')) { return; } if ($use_language) { @@ -1699,7 +1699,7 @@ function views_cache_set($cid, $data, $use_language = FALSE) { * The cache or FALSE on failure. */ function views_cache_get($cid, $use_language = FALSE) { - if (Drupal::config('views.settings')->get('skip_cache')) { + if (\Drupal::config('views.settings')->get('skip_cache')) { return FALSE; } if ($use_language) { diff --git a/core/modules/views/views.theme.inc b/core/modules/views/views.theme.inc index 2594138..6c0af6e 100644 --- a/core/modules/views/views.theme.inc +++ b/core/modules/views/views.theme.inc @@ -965,7 +965,7 @@ function template_preprocess_views_view_rss(&$variables) { $style = $view->style_plugin; - $config = Drupal::config('system.site'); + $config = \Drupal::config('system.site'); // The RSS 2.0 "spec" doesn't indicate HTML can be used in the description. // We strip all HTML tags, but need to prevent double encoding from properly diff --git a/core/modules/views/views.tokens.inc b/core/modules/views/views.tokens.inc index 91a53c6..bb198eb 100644 --- a/core/modules/views/views.tokens.inc +++ b/core/modules/views/views.tokens.inc @@ -67,7 +67,7 @@ function views_token_info() { * Implements hook_tokens(). */ function views_tokens($type, $tokens, array $data = array(), array $options = array()) { - $token_service = Drupal::token(); + $token_service = \Drupal::token(); $url_options = array('absolute' => TRUE); if (isset($options['language'])) { diff --git a/core/modules/views/views.views_execution.inc b/core/modules/views/views.views_execution.inc index 73ebd09..e730bbb 100644 --- a/core/modules/views/views.views_execution.inc +++ b/core/modules/views/views.views_execution.inc @@ -15,7 +15,7 @@ */ function views_views_query_substitutions(ViewExecutable $view) { return array( - '***CURRENT_VERSION***' => Drupal::VERSION, + '***CURRENT_VERSION***' => \Drupal::VERSION, '***CURRENT_TIME***' => REQUEST_TIME, '***CURRENT_LANGUAGE***' => language(Language::TYPE_CONTENT)->id, '***DEFAULT_LANGUAGE***' => language_default()->id, diff --git a/core/modules/views_ui/views_ui.module b/core/modules/views_ui/views_ui.module index 9e61cfd..7672a79 100644 --- a/core/modules/views_ui/views_ui.module +++ b/core/modules/views_ui/views_ui.module @@ -193,7 +193,7 @@ function views_ui_library_info() { $libraries['views_ui.admin'] = array( 'title' => 'Views UI ADMIN', - 'version' => Drupal::VERSION, + 'version' => \Drupal::VERSION, 'js' => array( $path . 'ajax.js' => array('group' => JS_DEFAULT), $path . 'views-admin.js' => array('group' => JS_DEFAULT), @@ -218,7 +218,7 @@ function views_ui_library_info() { */ function views_ui_preprocess_views_view(&$variables) { $view = $variables['view']; - if (!empty($view->live_preview) && Drupal::moduleHandler()->moduleExists('contextual')) { + if (!empty($view->live_preview) && \Drupal::moduleHandler()->moduleExists('contextual')) { $view->setShowAdminLinks(FALSE); foreach (array('title', 'header', 'exposed', 'rows', 'pager', 'more', 'footer', 'empty', 'attachment_after', 'attachment_before') as $section) { if (!empty($variables[$section])) { @@ -422,7 +422,7 @@ function views_ui_views_analyze(ViewExecutable $view) { continue; } if ($display->hasPath() && $path = $display->getOption('path')) { - $normal_path = Drupal::service('path.alias_manager.cached')->getSystemPath($path); + $normal_path = \Drupal::service('path.alias_manager.cached')->getSystemPath($path); if ($path != $normal_path) { $ret[] = Analyzer::formatMessage(t('You have configured display %display with a path which is an path alias as well. This might lead to unwanted effects so better use an internal path.', array('%display' => $display->display['display_title'])), 'warning'); } diff --git a/core/modules/views_ui/views_ui.theme.inc b/core/modules/views_ui/views_ui.theme.inc index a3e2d1b..8ae5733 100644 --- a/core/modules/views_ui/views_ui.theme.inc +++ b/core/modules/views_ui/views_ui.theme.inc @@ -180,7 +180,7 @@ function theme_views_ui_build_group_filter_form($variables) { drupal_render($form['default_group']['All']), '', array( - 'data' => Drupal::config('views.settings')->get('ui.exposed_filter_any_label') == 'old_any' ? t('<Any>') : t('- Any -'), + 'data' => \Drupal::config('views.settings')->get('ui.exposed_filter_any_label') == 'old_any' ? t('<Any>') : t('- Any -'), 'colspan' => 4, 'class' => array('class' => 'any-default-radios-row'), ), diff --git a/core/modules/xmlrpc/tests/modules/xmlrpc_test/xmlrpc_test.module b/core/modules/xmlrpc/tests/modules/xmlrpc_test/xmlrpc_test.module index 4a772ab..3207040 100644 --- a/core/modules/xmlrpc/tests/modules/xmlrpc_test/xmlrpc_test.module +++ b/core/modules/xmlrpc/tests/modules/xmlrpc_test/xmlrpc_test.module @@ -68,7 +68,7 @@ function xmlrpc_test_xmlrpc() { * Hide (or not) the system.methodSignature() service depending on a variable. */ function xmlrpc_test_xmlrpc_alter(&$services) { - $xmlprc_alter = Drupal::state()->get('xmlrpc_test.alter') ?: FALSE; + $xmlprc_alter = \Drupal::state()->get('xmlrpc_test.alter') ?: FALSE; if ($xmlprc_alter) { $remove = NULL; foreach ($services as $key => $value) { diff --git a/core/modules/xmlrpc/xmlrpc.inc b/core/modules/xmlrpc/xmlrpc.inc index d529fba..445993a 100644 --- a/core/modules/xmlrpc/xmlrpc.inc +++ b/core/modules/xmlrpc/xmlrpc.inc @@ -561,7 +561,7 @@ function _xmlrpc($url, array $args, array $headers = array()) { $args = $args[$method]; } $xmlrpc_request = xmlrpc_request($method, $args); - $request = Drupal::httpClient()->post($url, $headers, $xmlrpc_request->xml); + $request = \Drupal::httpClient()->post($url, $headers, $xmlrpc_request->xml); $request->setHeader('Content-Type', 'text/xml'); try { $response = $request->send(); diff --git a/core/modules/xmlrpc/xmlrpc.server.inc b/core/modules/xmlrpc/xmlrpc.server.inc index b68ccbb..8f171a5 100644 --- a/core/modules/xmlrpc/xmlrpc.server.inc +++ b/core/modules/xmlrpc/xmlrpc.server.inc @@ -16,7 +16,7 @@ */ function xmlrpc_server_page() { module_load_include('inc', 'xmlrpc'); - return xmlrpc_server(Drupal::moduleHandler()->invokeAll('xmlrpc')); + return xmlrpc_server(\Drupal::moduleHandler()->invokeAll('xmlrpc')); } /** diff --git a/core/profiles/minimal/minimal.install b/core/profiles/minimal/minimal.install index cdc4a18..6f08fe7 100644 --- a/core/profiles/minimal/minimal.install +++ b/core/profiles/minimal/minimal.install @@ -13,10 +13,10 @@ */ function minimal_install() { // Disable the user pictures on nodes. - Drupal::config('system.theme.global')->set('features.node_user_picture', FALSE)->save(); + \Drupal::config('system.theme.global')->set('features.node_user_picture', FALSE)->save(); // Allow visitor account creation, but with administrative approval. - Drupal::config('user.settings')->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(); + \Drupal::config('user.settings')->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(); // Enable default permissions for system roles. user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content')); diff --git a/core/profiles/standard/standard.install b/core/profiles/standard/standard.install index af30e20..acf8871 100644 --- a/core/profiles/standard/standard.install +++ b/core/profiles/standard/standard.install @@ -15,20 +15,20 @@ function standard_install() { // Enable Bartik theme and set it as default theme instead of Stark. // @see system_install() $default_theme = 'bartik'; - Drupal::config('system.theme') + \Drupal::config('system.theme') ->set('default', $default_theme) ->save(); theme_enable(array($default_theme)); theme_disable(array('stark')); // Set front page to "node". - Drupal::config('system.site')->set('page.front', 'node')->save(); + \Drupal::config('system.site')->set('page.front', 'node')->save(); // Default "Basic page" to have comments disabled. variable_set('comment_page', COMMENT_NODE_HIDDEN); // Allow visitor account creation with administrative approval. - $user_settings = Drupal::config('user.settings'); + $user_settings = \Drupal::config('user.settings'); $user_settings->set('register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)->save(); // Create user picture field. @@ -40,7 +40,7 @@ function standard_install() { user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'skip comment approval')); // Enable all permissions for the administrator role. - user_role_grant_permissions('administrator', array_keys(Drupal::moduleHandler()->invokeAll('permission'))); + user_role_grant_permissions('administrator', array_keys(\Drupal::moduleHandler()->invokeAll('permission'))); // Set this as the administrator role. $user_settings->set('admin_role', 'administrator')->save(); @@ -84,6 +84,6 @@ function standard_install() { // Enable the admin theme. theme_enable(array('seven')); - Drupal::config('system.theme')->set('admin', 'seven')->save(); - Drupal::config('node.settings')->set('use_admin_theme', '1')->save(); + \Drupal::config('system.theme')->set('admin', 'seven')->save(); + \Drupal::config('node.settings')->set('use_admin_theme', '1')->save(); } diff --git a/core/update.php b/core/update.php index 7ae8dd5..db92c1a 100644 --- a/core/update.php +++ b/core/update.php @@ -189,7 +189,7 @@ function update_helpful_links() { */ function update_flush_all_caches() { unset($GLOBALS['conf']['container_service_providers']['UpdateServiceProvider']); - Drupal::service('kernel')->updateModules(Drupal::moduleHandler()->getModuleList()); + \Drupal::service('kernel')->updateModules(\Drupal::moduleHandler()->getModuleList()); // No updates to run, so caches won't get flushed later. Clear them now. drupal_flush_all_caches(); @@ -351,7 +351,7 @@ function update_access_allowed() { // Calls to user_access() might fail during the Drupal 6 to 7 update process, // so we fall back on requiring that the user be logged in as user #1. try { - $module_handler = Drupal::moduleHandler(); + $module_handler = \Drupal::moduleHandler(); $module_filenames = $module_handler->getModuleList(); $module_filenames['user'] = 'core/modules/user/user.module'; $module_handler->setModuleList($module_filenames); @@ -407,7 +407,7 @@ function update_extra_requirements($requirements = NULL) { */ function update_check_requirements($skip_warnings = FALSE) { // Check requirements of all loaded modules. - $requirements = Drupal::moduleHandler()->invokeAll('requirements', array('update')); + $requirements = \Drupal::moduleHandler()->invokeAll('requirements', array('update')); $requirements += update_extra_requirements(); $severity = drupal_requirements_severity($requirements); @@ -454,11 +454,11 @@ function update_check_requirements($skip_warnings = FALSE) { // A request object from the HTTPFoundation to tell us about the request. $request = Request::createFromGlobals(); -Drupal::getContainer()->set('request', $request); +\Drupal::getContainer()->set('request', $request); // Ensure that URLs generated for the home and admin pages don't have 'update.php' // in them. -$generator = Drupal::urlGenerator(); +$generator = \Drupal::urlGenerator(); $generator->setBasePath(str_replace('/core', '', $request->getBasePath()) . '/'); $generator->setScriptPath('');