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..25a1f53 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,17 +1861,17 @@ 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')) { - $css_assets = \Drupal::service('asset.css.collection_optimizer')->optimize($css_assets); + 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); + return \\Drupal::service('asset.css.collection_renderer')->render($css_assets); } /** * 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,10 +2488,10 @@ 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')) { - $js_assets = \Drupal::service('asset.js.collection_optimizer')->optimize($js_assets); + 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); + 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')); } @@ -3041,7 +3041,7 @@ function drupal_json_decode($var) { * @deprecated as of Drupal 8.0. Use the 'private_key' service instead. */ function drupal_get_private_key() { - return \Drupal::service('private_key')->get(); + return \\Drupal::service('private_key')->get(); } /** @@ -3061,7 +3061,7 @@ function drupal_get_private_key() { * @deprecated as of Drupal 8.0. Use the csrf_token service instead. */ function drupal_get_token($value = '') { - return \Drupal::csrfToken()->get($value); + return \\Drupal::csrfToken()->get($value); } /** @@ -3083,7 +3083,7 @@ function drupal_get_token($value = '') { * @deprecated as of Drupal 8.0. Use the csrf_token service instead. */ function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) { - return \Drupal::csrfToken()->validate($token, $value, $skip_anonymous); + return \\Drupal::csrfToken()->validate($token, $value, $skip_anonymous); } /** @@ -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..ffea458 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -55,7 +55,7 @@ function ($value) use ($name) { return !preg_match('/^' . $name . '\./', $value); } ); - $enabled_extensions = array_keys(\Drupal::moduleHandler()->getModuleList()); + $enabled_extensions = array_keys(\\Drupal::moduleHandler()->getModuleList()); $enabled_extensions += array_keys(array_filter(list_themes(), function ($theme) {return $theme->status;})); $other_module_config = array_filter($other_module_config, function ($config_name) use ($enabled_extensions) { @@ -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(); } } @@ -111,14 +111,14 @@ function config_get_storage_names_with_prefix($prefix = '') { * Retrieves a configuration object. * * This is the main entry point to the configuration API. Calling - * @code \Drupal::config('book.admin') @endcode will return a configuration + * @code \\Drupal::config('book.admin') @endcode will return a configuration * object in which the book module can store its administrative settings. * - * @deprecated as of Drupal 8.0. Use \Drupal::config() instead. + * @deprecated as of Drupal 8.0. Use \\Drupal::config() instead. * * @param string $name * The name of the configuration object to retrieve. The name corresponds to - * a configuration file. For @code \Drupal::config('book.admin') @endcode, the + * a configuration file. For @code \\Drupal::config('book.admin') @endcode, the * config object returned will contain the contents of book.admin * configuration file. * @@ -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..281a119 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); } @@ -970,12 +970,12 @@ function _menu_link_translate(&$item, $translate = FALSE) { * If the system path in $href does not match the $route. */ function menu_item_route_access(Route $route, $href, &$map) { - $request = RequestHelper::duplicate(\Drupal::request(), '/' . $href); + $request = RequestHelper::duplicate(\\Drupal::request(), '/' . $href); $request->attributes->set('_system_path', $href); // 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); } /** @@ -1277,7 +1277,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL, $only_active_trail = // Check if the active trail has been overridden for this menu tree. $active_path = menu_tree_get_path($menu_name); // Load the router item corresponding to the current page. - $request = \Drupal::request(); + $request = \\Drupal::request(); $system_path = NULL; if ($route_name = $request->attributes->get(RouteObjectInterface::ROUTE_NAME)) { // @todo https://drupal.org/node/2068471 is adding support so we can tell @@ -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..b650076 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']; @@ -2747,7 +2747,7 @@ function template_preprocess_page(&$variables) { // @see menu_tree_page_data() $variables['breadcrumb'] = array( '#theme' => 'breadcrumb', - '#breadcrumb' => \Drupal::service('breadcrumb')->build(\Drupal::request()->attributes->all()), + '#breadcrumb' => \\Drupal::service('breadcrumb')->build(\\Drupal::request()->attributes->all()), ); } @@ -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..512c6b8 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']); } } @@ -1257,7 +1257,7 @@ function update_already_performed($module, $number) { /** * Invokes hook_update_dependencies() in all installed modules. * - * This function is similar to \Drupal::moduleHandler()->invokeAll(), with the + * This function is similar to \\Drupal::moduleHandler()->invokeAll(), with the * main difference that it does not require that a module be enabled to invoke * its hook, only that it be installed. This allows the update system to * properly perform updates even on modules that are currently disabled. @@ -1266,14 +1266,14 @@ function update_already_performed($module, $number) { * An array of return values obtained by merging the results of the * hook_update_dependencies() implementations in all installed modules. * - * @see \Drupal::moduleHandler()->invokeAll() + * @see \\Drupal::moduleHandler()->invokeAll() * @see hook_update_dependencies() */ 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) { + // the same order that \\Drupal::moduleHandler()->invokeAll() does. + 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..9cdd203 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 { @@ -226,12 +226,12 @@ public static function lock() { * Retrieves a configuration object. * * This is the main entry point to the configuration API. Calling - * @code \Drupal::config('book.admin') @endcode will return a configuration + * @code \\Drupal::config('book.admin') @endcode will return a configuration * object in which the book module can store its administrative settings. * * @param string $name * The name of the configuration object to retrieve. The name corresponds to - * a configuration file. For @code \Drupal::config('book.admin') @endcode, the config + * a configuration file. For @code \\Drupal::config('book.admin') @endcode, the config * object returned will contain the contents of book.admin configuration file. * * @return \Drupal\Core\Config\Config @@ -286,7 +286,7 @@ public static function keyValue($collection) { * that does not need deploying and does not need human editing; for example, * the last time cron was run. Data which needs to be edited by humans and * needs to be the same across development, production, etc. environments - * (for example, the system maintenance message) should use \Drupal::config() instead. + * (for example, the system maintenance message) should use \\Drupal::config() instead. * * @return \Drupal\Core\KeyValueStore\KeyValueStoreInterface */ @@ -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/Asset/AssetDumper.php b/core/lib/Drupal/Core/Asset/AssetDumper.php index 7ff85ed..048ddaf 100644 --- a/core/lib/Drupal/Core/Asset/AssetDumper.php +++ b/core/lib/Drupal/Core/Asset/AssetDumper.php @@ -41,7 +41,7 @@ public function dump($data, $file_extension) { // file) in generating the file anyway. Sites on servers where rewrite rules // aren't working can set css.gzip to FALSE in order to skip // generating a file that won't be used. - if (\Drupal::config('system.performance')->get($file_extension . '.gzip') && extension_loaded('zlib')) { + if (\\Drupal::config('system.performance')->get($file_extension . '.gzip') && extension_loaded('zlib')) { if (!file_exists($uri . '.gz') && !file_unmanaged_save_data(gzencode($data, 9, FORCE_GZIP), $uri . '.gz', FILE_EXISTS_REPLACE)) { return FALSE; } diff --git a/core/lib/Drupal/Core/Cache/Cache.php b/core/lib/Drupal/Core/Cache/Cache.php index a92a27e..a3cf007 100644 --- a/core/lib/Drupal/Core/Cache/Cache.php +++ b/core/lib/Drupal/Core/Cache/Cache.php @@ -58,7 +58,7 @@ public static function invalidateTags(array $tags) { */ public static function getBins() { $bins = array(); - $container = \Drupal::getContainer(); + $container = \\Drupal::getContainer(); foreach ($container->getParameter('cache_bins') as $service_id => $bin) { $bins[$bin] = $container->get($service_id); } diff --git a/core/lib/Drupal/Core/Config/Context/ContextInterface.php b/core/lib/Drupal/Core/Config/Context/ContextInterface.php index e7e4904..8b7c621 100644 --- a/core/lib/Drupal/Core/Config/Context/ContextInterface.php +++ b/core/lib/Drupal/Core/Config/Context/ContextInterface.php @@ -18,7 +18,7 @@ * * @see Drupal\Core\Config\Config * @see Drupal\Core\Config\ConfigFactory - * @see \Drupal::config() + * @see \\Drupal::config() */ interface ContextInterface { diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index 60d0ce0..23ef7b3 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -293,7 +293,7 @@ protected function buildQuery($ids, $revision_id = FALSE) { */ protected function attachLoad(&$queried_entities, $revision_id = FALSE) { // Call hook_entity_load(). - foreach (\Drupal::moduleHandler()->getImplementations('entity_load') as $module) { + foreach (\\Drupal::moduleHandler()->getImplementations('entity_load') as $module) { $function = $module . '_entity_load'; $function($queried_entities, $this->entityType); } @@ -301,7 +301,7 @@ protected function attachLoad(&$queried_entities, $revision_id = FALSE) { // always the queried entities, followed by additional arguments set in // $this->hookLoadArguments. $args = array_merge(array($queried_entities), $this->hookLoadArguments); - foreach (\Drupal::moduleHandler()->getImplementations($this->entityType . '_load') as $module) { + foreach (\\Drupal::moduleHandler()->getImplementations($this->entityType . '_load') as $module) { call_user_func_array($module . '_' . $this->entityType . '_load', $args); } } diff --git a/core/lib/Drupal/Core/Config/Entity/Query/Query.php b/core/lib/Drupal/Core/Config/Entity/Query/Query.php index 1d56bf1..a294485 100644 --- a/core/lib/Drupal/Core/Config/Entity/Query/Query.php +++ b/core/lib/Drupal/Core/Config/Entity/Query/Query.php @@ -80,7 +80,7 @@ public function execute() { $names = $this->configStorage->listAll($prefix); $configs = array(); foreach ($names as $name) { - $configs[substr($name, $prefix_length)] = \Drupal::config($name)->get(); + $configs[substr($name, $prefix_length)] = \\Drupal::config($name)->get(); } $result = $this->condition->compile($configs); diff --git a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php index 689b14d..28ac9a4 100644 --- a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php +++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php @@ -25,7 +25,7 @@ class ExtensionInstallStorage extends InstallStorage { */ protected function getAllFolders() { if (!isset($this->folders)) { - $this->folders = $this->getComponentNames('module', array_keys(\Drupal::moduleHandler()->getModuleList())); + $this->folders = $this->getComponentNames('module', array_keys(\\Drupal::moduleHandler()->getModuleList())); $this->folders += $this->getComponentNames('theme', array_keys(array_filter(list_themes(), function ($theme) {return $theme->status;}))); } return $this->folders; diff --git a/core/lib/Drupal/Core/Controller/ControllerBase.php b/core/lib/Drupal/Core/Controller/ControllerBase.php index b89a09a..b56cae5 100644 --- a/core/lib/Drupal/Core/Controller/ControllerBase.php +++ b/core/lib/Drupal/Core/Controller/ControllerBase.php @@ -129,7 +129,7 @@ protected function cache($bin = 'cache') { * * @param string $name * The name of the configuration object to retrieve. The name corresponds to - * a configuration file. For @code \Drupal::config('book.admin') @endcode, + * a configuration file. For @code \\Drupal::config('book.admin') @endcode, * the config object returned will contain the contents of book.admin * configuration file. * @@ -269,7 +269,7 @@ protected function languageManager() { * The service container. */ protected function container() { - return \Drupal::getContainer(); + return \\Drupal::getContainer(); } /** diff --git a/core/lib/Drupal/Core/Controller/ExceptionController.php b/core/lib/Drupal/Core/Controller/ExceptionController.php index b03cc8e..be02f2d 100644 --- a/core/lib/Drupal/Core/Controller/ExceptionController.php +++ b/core/lib/Drupal/Core/Controller/ExceptionController.php @@ -84,7 +84,7 @@ public function on403Html(FlattenException $exception, Request $request) { $system_path = $request->attributes->get('_system_path'); watchdog('access denied', $system_path, NULL, WATCHDOG_WARNING); - $path = $this->container->get('path.alias_manager')->getSystemPath(\Drupal::config('system.site')->get('page.403')); + $path = $this->container->get('path.alias_manager')->getSystemPath(\\Drupal::config('system.site')->get('page.403')); if ($path && $path != $system_path) { // Keep old path for reference, and to allow forms to redirect to it. if (!$request->query->has('destination')) { @@ -139,7 +139,7 @@ public function on404Html(FlattenException $exception, Request $request) { watchdog('page not found', check_plain($request->attributes->get('_system_path')), NULL, WATCHDOG_WARNING); // Check for and return a fast 404 page if configured. - $config = \Drupal::config('system.performance'); + $config = \\Drupal::config('system.performance'); $exclude_paths = $config->get('fast_404.exclude_paths'); if ($config->get('fast_404.enabled') && $exclude_paths && !preg_match($exclude_paths, $request->getPathInfo())) { @@ -158,7 +158,7 @@ public function on404Html(FlattenException $exception, Request $request) { $request->query->set('destination', $system_path); } - $path = $this->container->get('path.alias_manager')->getSystemPath(\Drupal::config('system.site')->get('page.404')); + $path = $this->container->get('path.alias_manager')->getSystemPath(\\Drupal::config('system.site')->get('page.404')); if ($path && $path != $system_path) { // @todo Um, how do I specify an override URL again? Totally not clear. Do // that and sub-call the kernel rather than using meah(). diff --git a/core/lib/Drupal/Core/Datetime/Date.php b/core/lib/Drupal/Core/Datetime/Date.php index dbd3dcf..bf350fa 100644 --- a/core/lib/Drupal/Core/Datetime/Date.php +++ b/core/lib/Drupal/Core/Datetime/Date.php @@ -142,7 +142,7 @@ protected function dateFormat($format) { */ protected function country() { if ($this->country === NULL) { - $this->country = \Drupal::config('system.date')->get('country.default'); + $this->country = \\Drupal::config('system.date')->get('country.default'); } return $this->country; } diff --git a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php index de6c0f8..36e6370 100644 --- a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php +++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php @@ -57,7 +57,7 @@ public function __construct($time = 'now', $timezone = NULL, $settings = array() } if (!isset($settings['country'])) { - $settings['country'] = \Drupal::config('system.date')->get('country.default'); + $settings['country'] = \\Drupal::config('system.date')->get('country.default'); } // Instantiate the parent class. diff --git a/core/lib/Drupal/Core/DependencyInjection/DependencySerialization.php b/core/lib/Drupal/Core/DependencyInjection/DependencySerialization.php index feb50f1..6c79bd0 100644 --- a/core/lib/Drupal/Core/DependencyInjection/DependencySerialization.php +++ b/core/lib/Drupal/Core/DependencyInjection/DependencySerialization.php @@ -42,7 +42,7 @@ public function __sleep() { * {@inheritdoc} */ public function __wakeup() { - $container = \Drupal::getContainer(); + $container = \\Drupal::getContainer(); foreach ($this->_serviceIds as $key => $service_id) { $this->$key = $container->get($service_id); } diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 1bf9c05..ce94884 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -447,7 +447,7 @@ protected function initializeContainer() { $this->container->enterScope('request'); $this->container->set('request', $request); } - \Drupal::setContainer($this->container); + \\Drupal::setContainer($this->container); } /** diff --git a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php index c016093..b9e1800 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageController.php @@ -246,7 +246,7 @@ public function deleteRevision($revision_id) { */ public function loadByProperties(array $values = array()) { // Build a query to fetch the entity IDs. - $entity_query = \Drupal::entityQuery($this->entityType); + $entity_query = \\Drupal::entityQuery($this->entityType); $this->buildPropertyQuery($entity_query, $values); $result = $entity_query->execute(); return $result ? $this->loadMultiple($result) : array(); @@ -355,7 +355,7 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) { } // Call hook_entity_load(). - foreach (\Drupal::moduleHandler()->getImplementations('entity_load') as $module) { + foreach (\\Drupal::moduleHandler()->getImplementations('entity_load') as $module) { $function = $module . '_entity_load'; $function($queried_entities, $this->entityType); } @@ -363,7 +363,7 @@ protected function attachLoad(&$queried_entities, $load_revision = FALSE) { // always the queried entities, followed by additional arguments set in // $this->hookLoadArguments. $args = array_merge(array($queried_entities), $this->hookLoadArguments); - foreach (\Drupal::moduleHandler()->getImplementations($this->entityType . '_load') as $module) { + foreach (\\Drupal::moduleHandler()->getImplementations($this->entityType . '_load') as $module) { call_user_func_array($module . '_' . $this->entityType . '_load', $args); } } @@ -1064,7 +1064,7 @@ public static function _fieldSqlSchema(FieldInterface $field, array $schema = NU * @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. * @@ -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. * @@ -1173,7 +1173,7 @@ static public function _fieldIndexName(FieldInterface $field, $index) { * @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/DatabaseStorageControllerNG.php b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php index 42ea348..aee238e 100644 --- a/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php +++ b/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php @@ -288,7 +288,7 @@ protected function attachPropertyData(array &$entities, $revision_id = FALSE) { } $data = $query->execute(); - $field_definition = \Drupal::entityManager()->getFieldDefinitions($this->entityType); + $field_definition = \\Drupal::entityManager()->getFieldDefinitions($this->entityType); $translations = array(); if ($this->revisionTable) { $data_fields = array_flip(array_diff(drupal_schema_fields_sql($this->entityInfo['revision_table']), drupal_schema_fields_sql($this->entityInfo['base_table']))); diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 68404ba..e8475e8 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -274,11 +274,11 @@ public function getIterator() { */ public function access($operation = 'view', AccountInterface $account = NULL) { if ($operation == 'create') { - return \Drupal::entityManager() + return \\Drupal::entityManager() ->getAccessController($this->entityType) ->createAccess($this->bundle(), $account); } - return \Drupal::entityManager() + return \\Drupal::entityManager() ->getAccessController($this->entityType) ->access($this, $operation, Language::LANGCODE_DEFAULT, $account); } @@ -353,7 +353,7 @@ public function getTranslationLanguages($include_default = TRUE) { * Implements \Drupal\Core\Entity\EntityInterface::save(). */ public function save() { - return \Drupal::entityManager()->getStorageController($this->entityType)->save($this); + return \\Drupal::entityManager()->getStorageController($this->entityType)->save($this); } /** @@ -361,7 +361,7 @@ public function save() { */ public function delete() { if (!$this->isNew()) { - \Drupal::entityManager()->getStorageController($this->entityType)->delete(array($this->id() => $this)); + \\Drupal::entityManager()->getStorageController($this->entityType)->delete(array($this->id() => $this)); } } @@ -385,7 +385,7 @@ public function createDuplicate() { * Implements \Drupal\Core\Entity\EntityInterface::entityInfo(). */ public function entityInfo() { - return \Drupal::entityManager()->getDefinition($this->entityType()); + return \\Drupal::entityManager()->getDefinition($this->entityType()); } /** @@ -479,7 +479,7 @@ public function getConstraints() { */ public function validate() { // @todo: Add the typed data manager as proper dependency. - return \Drupal::typedData()->getValidator()->validate($this); + return \\Drupal::typedData()->getValidator()->validate($this); } /** diff --git a/core/lib/Drupal/Core/Entity/EntityFormController.php b/core/lib/Drupal/Core/Entity/EntityFormController.php index 147baff..7a6b4a7 100644 --- a/core/lib/Drupal/Core/Entity/EntityFormController.php +++ b/core/lib/Drupal/Core/Entity/EntityFormController.php @@ -286,7 +286,7 @@ public function validate(array $form, array &$form_state) { else { // For BC entities, iterate through each field instance and // instantiate NG items objects manually. - $definitions = \Drupal::entityManager()->getFieldDefinitions($entity_type, $entity->bundle()); + $definitions = \\Drupal::entityManager()->getFieldDefinitions($entity_type, $entity->bundle()); foreach (field_info_instances($entity_type, $entity->bundle()) as $field_name => $instance) { $langcode = field_is_translatable($entity_type, $instance->getField()) ? $entity_langcode : Language::LANGCODE_NOT_SPECIFIED; @@ -294,7 +294,7 @@ public function validate(array $form, array &$form_state) { $items = isset($entity->{$field_name}[$langcode]) ? $entity->{$field_name}[$langcode] : array(); // @todo Exception : calls setValue(), tries to set the 'formatted' // property. - $field = \Drupal::typedData()->create($definitions[$field_name], $items, $field_name, $entity); + $field = \\Drupal::typedData()->create($definitions[$field_name], $items, $field_name, $entity); $field_violations = $field->validate(); if (count($field_violations)) { $violations[$field->getName()] = $field_violations; diff --git a/core/lib/Drupal/Core/Entity/EntityListController.php b/core/lib/Drupal/Core/Entity/EntityListController.php index 1846b5f..f1141a0 100644 --- a/core/lib/Drupal/Core/Entity/EntityListController.php +++ b/core/lib/Drupal/Core/Entity/EntityListController.php @@ -230,7 +230,7 @@ protected function t($string, array $args = array(), array $options = array()) { */ protected function translationManager() { if (!$this->translationManager) { - $this->translationManager = \Drupal::translation(); + $this->translationManager = \\Drupal::translation(); } return $this->translationManager; } 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/EntityNG.php b/core/lib/Drupal/Core/Entity/EntityNG.php index d0b6b4c..5a0b4bd 100644 --- a/core/lib/Drupal/Core/Entity/EntityNG.php +++ b/core/lib/Drupal/Core/Entity/EntityNG.php @@ -315,7 +315,7 @@ protected function getTranslatedField($property_name, $langcode) { $value = $this->values[$property_name][$default_langcode]; } } - $field = \Drupal::typedData()->getPropertyInstance($this, $property_name, $value); + $field = \\Drupal::typedData()->getPropertyInstance($this, $property_name, $value); $field->setLangcode($langcode); $this->fields[$property_name][$langcode] = $field; } @@ -371,7 +371,7 @@ public function getPropertyDefinition($name) { public function getPropertyDefinitions() { if (!isset($this->fieldDefinitions)) { $bundle = $this->bundle != $this->entityType ? $this->bundle : NULL; - $this->fieldDefinitions = \Drupal::entityManager()->getFieldDefinitions($this->entityType, $bundle); + $this->fieldDefinitions = \\Drupal::entityManager()->getFieldDefinitions($this->entityType, $bundle); } return $this->fieldDefinitions; } @@ -416,11 +416,11 @@ public function isEmpty() { */ public function access($operation = 'view', AccountInterface $account = NULL) { if ($operation == 'create') { - return \Drupal::entityManager() + return \\Drupal::entityManager() ->getAccessController($this->entityType) ->createAccess($this->bundle(), $account); } - return \Drupal::entityManager() + return \\Drupal::entityManager() ->getAccessController($this->entityType) ->access($this, $operation, $this->activeLangcode, $account); } @@ -589,7 +589,7 @@ public function addTranslation($langcode, array $values = array()) { // specified language. $info = $this->entityInfo(); $default_values = array($info['entity_keys']['bundle'] => $this->bundle, 'langcode' => $langcode); - $entity = \Drupal::entityManager() + $entity = \\Drupal::entityManager() ->getStorageController($this->entityType()) ->create($default_values); diff --git a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php index 43ff5f1..243d869 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageControllerBase.php @@ -151,7 +151,7 @@ public function invokeFieldMethod($method, EntityInterface $entity) { else { // For BC entities, iterate through fields and instantiate NG items // objects manually. - $definitions = \Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); + $definitions = \\Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); foreach ($definitions as $field_name => $definition) { if (!empty($definition['configurable'])) { // Create the items object. @@ -159,7 +159,7 @@ public function invokeFieldMethod($method, EntityInterface $entity) { // @todo Exception : this calls setValue(), tries to set the // 'formatted' property. For now, this is worked around by // commenting out the Exception in TextProcessed::setValue(). - $items = \Drupal::typedData()->create($definition, $itemsBC, $field_name, $entity); + $items = \\Drupal::typedData()->create($definition, $itemsBC, $field_name, $entity); $items->$method(); // Put back the items values in the entity. @@ -182,7 +182,7 @@ public function invokeFieldItemPrepareCache(EntityInterface $entity) { // and the second code branch when all core entity types are converted. if ($translation = $entity->getTranslation($langcode)) { foreach ($translation->getPropertyDefinitions() as $property => $definition) { - $type_definition = \Drupal::typedData()->getDefinition($definition['type']); + $type_definition = \\Drupal::typedData()->getDefinition($definition['type']); // Only create the item objects if needed. if (is_subclass_of($type_definition['class'], '\Drupal\Core\Entity\Field\PrepareCacheInterface') // Prevent legacy field types from skewing performance too much by @@ -204,10 +204,10 @@ public function invokeFieldItemPrepareCache(EntityInterface $entity) { else { // For BC entities, iterate through the fields and instantiate NG items // objects manually. - $definitions = \Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); + $definitions = \\Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); foreach ($definitions as $field_name => $definition) { if (!empty($definition['configurable'])) { - $type_definition = \Drupal::typedData()->getDefinition($definition['type']); + $type_definition = \\Drupal::typedData()->getDefinition($definition['type']); // Only create the item objects if needed. if (is_subclass_of($type_definition['class'], '\Drupal\Core\Entity\Field\PrepareCacheInterface') // @todo Remove once all core field types have been converted @@ -216,7 +216,7 @@ public function invokeFieldItemPrepareCache(EntityInterface $entity) { // Create the items object. $items = isset($entity->{$field_name}[$langcode]) ? $entity->{$field_name}[$langcode] : array(); - $itemsNG = \Drupal::typedData()->create($definition, $items, $field_name, $entity); + $itemsNG = \\Drupal::typedData()->create($definition, $items, $field_name, $entity); foreach ($itemsNG as $item) { $item->prepareCache(); diff --git a/core/lib/Drupal/Core/Entity/Field/Field.php b/core/lib/Drupal/Core/Entity/Field/Field.php index 6f8382a..0e75854 100644 --- a/core/lib/Drupal/Core/Entity/Field/Field.php +++ b/core/lib/Drupal/Core/Entity/Field/Field.php @@ -209,7 +209,7 @@ public function access($operation = 'view', AccountInterface $account = NULL) { // Invoke hook and collect grants/denies for field access from other // modules. Our default access flag is masked under the ':default' key. $grants = array(':default' => $access); - $hook_implementations = \Drupal::moduleHandler()->getImplementations('entity_field_access'); + $hook_implementations = \\Drupal::moduleHandler()->getImplementations('entity_field_access'); foreach ($hook_implementations as $module) { $grants = array_merge($grants, array($module => module_invoke($module, 'entity_field_access', $operation, $this, $account))); } @@ -291,7 +291,7 @@ public function getConstraints() { // @todo: Separate list and list item definitions to separate constraints. $constraints = array(); if (!empty($this->definition['required'])) { - $constraints[] = \Drupal::typedData()->getValidationConstraintManager()->create('NotNull', array()); + $constraints[] = \\Drupal::typedData()->getValidationConstraintManager()->create('NotNull', array()); } return $constraints; } diff --git a/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php b/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php index 15744c0..d2fe207 100644 --- a/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php +++ b/core/lib/Drupal/Core/Entity/Field/FieldItemBase.php @@ -31,7 +31,7 @@ public function __construct(array $definition, $name = NULL, TypedDataInterface // with the whole item. foreach ($this->getPropertyDefinitions() as $name => $definition) { if (!empty($definition['computed'])) { - $this->properties[$name] = \Drupal::typedData()->getPropertyInstance($this, $name); + $this->properties[$name] = \\Drupal::typedData()->getPropertyInstance($this, $name); } } } @@ -193,7 +193,7 @@ public function getConstraints() { // If property constraints are present add in a ComplexData constraint for // applying them. if (!empty($this->definition['property_constraints'])) { - $constraints[] = \Drupal::typedData()->getValidationConstraintManager() + $constraints[] = \\Drupal::typedData()->getValidationConstraintManager() ->create('ComplexData', $this->definition['property_constraints']); } return $constraints; diff --git a/core/lib/Drupal/Core/Entity/FieldableEntityStorageControllerBase.php b/core/lib/Drupal/Core/Entity/FieldableEntityStorageControllerBase.php index 5ee2309..ce6f87c 100644 --- a/core/lib/Drupal/Core/Entity/FieldableEntityStorageControllerBase.php +++ b/core/lib/Drupal/Core/Entity/FieldableEntityStorageControllerBase.php @@ -258,7 +258,7 @@ public function onFieldItemsPurge(EntityInterface $entity, FieldInstanceInterfac if ($values = $this->readFieldItemsToPurge($entity, $instance)) { $field = $instance->getField(); $definition = _field_generate_entity_field_definition($field, $instance); - $items = \Drupal::typedData()->create($definition, $values, $field->getFieldName(), $entity); + $items = \\Drupal::typedData()->create($definition, $values, $field->getFieldName(), $entity); $items->delete(); } $this->purgeFieldItems($entity, $instance); 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/Entity/Query/Sql/Tables.php b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php index 80ad70a..45da3d8 100644 --- a/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php +++ b/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php @@ -57,7 +57,7 @@ public function __construct(SelectInterface $sql_query) { */ public function addField($field, $type, $langcode) { $entity_type = $this->sqlQuery->getMetaData('entity_type'); - $entity_manager = \Drupal::entityManager(); + $entity_manager = \\Drupal::entityManager(); $field_info = FieldInfo::fieldInfo(); $age = $this->sqlQuery->getMetaData('age'); // This variable ensures grouping works correctly. For example: diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index 112644f..50bf973 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -100,7 +100,7 @@ public function onRespond(FilterResponseEvent $event) { $response->headers->set($name, $value, FALSE); } - $max_age = \Drupal::config('system.performance')->get('cache.page.max_age'); + $max_age = \\Drupal::config('system.performance')->get('cache.page.max_age'); if ($max_age > 0 && ($cache = drupal_page_set_cache($response, $request))) { drupal_serve_page_from_cache($cache, $response, $request); } diff --git a/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php index 39aad11..465e2b4 100644 --- a/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/MaintenanceModeSubscriber.php @@ -48,7 +48,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) { $maintenance_page = array( '#theme' => 'maintenance_page', '#content' => filter_xss_admin( - t(\Drupal::config('system.maintenance')->get('message'), array('@site' => \Drupal::config('system.site')->get('name'))) + t(\\Drupal::config('system.maintenance')->get('message'), array('@site' => \\Drupal::config('system.site')->get('name'))) ), ); $content = drupal_render($maintenance_page); diff --git a/core/lib/Drupal/Core/Executable/ExecutablePluginBase.php b/core/lib/Drupal/Core/Executable/ExecutablePluginBase.php index 36b11c4..9fe1758 100644 --- a/core/lib/Drupal/Core/Executable/ExecutablePluginBase.php +++ b/core/lib/Drupal/Core/Executable/ExecutablePluginBase.php @@ -88,14 +88,14 @@ public function getConfig() { * * @todo This doesn't belong here. Move this into a new base class in * http://drupal.org/node/1764380. - * @todo This does not set a value in \Drupal::config(), so the name is confusing. + * @todo This does not set a value in \\Drupal::config(), so the name is confusing. * * @return \Drupal\Core\Executable\ExecutablePluginBase. * The executable object for chaining. */ public function setConfig($key, $value) { if ($definition = $this->getConfigDefinition($key)) { - $typed_data = \Drupal::typedData()->create($definition, $value); + $typed_data = \\Drupal::typedData()->create($definition, $value); if ($typed_data->validate()->count() > 0) { throw new PluginException("The provided configuration value does not pass validation."); 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/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index 81fe970..2fbc590 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -464,7 +464,7 @@ public static function parseDependency($dependency) { // supports. Also, op is optional and defaults to equals. $p_op = '(?!=|==|=|<|<=|>|>=|<>)?'; // Core version is always optional: 8.x-2.x and 2.x is treated the same. - $p_core = '(?:' . preg_quote(\Drupal::CORE_COMPATIBILITY) . '-)?'; + $p_core = '(?:' . preg_quote(\\Drupal::CORE_COMPATIBILITY) . '-)?'; $p_major = '(?\d+)'; // By setting the minor version to x, branches can be matched. $p_minor = '(?(?:\d+|x)(?:-[A-Za-z]+\d+)?)'; @@ -555,8 +555,8 @@ public function enable($module_list, $enable_dependencies = TRUE) { $modules_installed = array(); $modules_enabled = array(); - $module_config = \Drupal::config('system.module'); - $disabled_config = \Drupal::config('system.module.disabled'); + $module_config = \\Drupal::config('system.module'); + $disabled_config = \\Drupal::config('system.module.disabled'); foreach ($module_list as $module) { // Only process modules that are not already enabled. // A module is only enabled if it is configured as enabled. Custom or @@ -720,8 +720,8 @@ function disable($module_list, $disable_dependents = TRUE) { $invoke_modules = array(); - $module_config = \Drupal::config('system.module'); - $disabled_config = \Drupal::config('system.module.disabled'); + $module_config = \\Drupal::config('system.module'); + $disabled_config = \\Drupal::config('system.module.disabled'); foreach ($module_list as $module) { // Only process modules that are enabled. // A module is only enabled if it is configured as enabled. Custom or @@ -810,8 +810,8 @@ public function uninstall($module_list = array(), $uninstall_dependents = TRUE) $module_list = array_keys($module_list); } - $schema_store = \Drupal::keyValue('system.schema'); - $disabled_config = \Drupal::config('system.module.disabled'); + $schema_store = \\Drupal::keyValue('system.schema'); + $disabled_config = \\Drupal::config('system.module.disabled'); foreach ($module_list as $module) { // Uninstall the module. module_load_install($module); @@ -835,7 +835,7 @@ public function uninstall($module_list = array(), $uninstall_dependents = TRUE) // be extremely rare. if ($tag['name'] == 'cache.bin' && isset($definition['factory_service']) && isset($definition['factory_method']) && !empty($definition['arguments'])) { try { - $factory = \Drupal::service($definition['factory_service']); + $factory = \\Drupal::service($definition['factory_service']); if (method_exists($factory, $definition['factory_method'])) { $backend = call_user_func_array(array($factory, $definition['factory_method']), $definition['arguments']); if ($backend instanceof CacheBackendInterface) { diff --git a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php index 78553d9..8d9675e 100644 --- a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php @@ -59,7 +59,7 @@ public function getImplementations($hook) { * {@inheritdoc} */ public function enable($module_list, $enable_dependencies = TRUE) { - $schema_store = \Drupal::keyValue('system.schema'); + $schema_store = \\Drupal::keyValue('system.schema'); $old_schema = array(); foreach ($module_list as $module) { // Check for initial schema and install it. The schema version of a newly @@ -75,13 +75,13 @@ public function enable($module_list, $enable_dependencies = TRUE) { } } // Enable the module with a weight of 0. - $module_config = \Drupal::config('system.module'); + $module_config = \\Drupal::config('system.module'); $module_config ->set("enabled.$module", 0) ->set('enabled', module_config_sort($module_config->get('enabled'))) ->save(); // Ensure the module is not contained in disabled modules. - \Drupal::config('system.module.disabled') + \\Drupal::config('system.module.disabled') ->clear($module) ->save(); diff --git a/core/lib/Drupal/Core/Form/FormBase.php b/core/lib/Drupal/Core/Form/FormBase.php index cbdd0cc..05128f2 100644 --- a/core/lib/Drupal/Core/Form/FormBase.php +++ b/core/lib/Drupal/Core/Form/FormBase.php @@ -144,7 +144,7 @@ protected function currentUser() { */ protected function urlGenerator() { if (!$this->urlGenerator) { - $this->urlGenerator = \Drupal::urlGenerator(); + $this->urlGenerator = \\Drupal::urlGenerator(); } return $this->urlGenerator; } @@ -166,7 +166,7 @@ public function setUrlGenerator(UrlGeneratorInterface $url_generator) { * The service container. */ protected function container() { - return \Drupal::getContainer(); + return \\Drupal::getContainer(); } } diff --git a/core/lib/Drupal/Core/Mail/PhpMail.php b/core/lib/Drupal/Core/Mail/PhpMail.php index d82d770..f7c6bd5 100644 --- a/core/lib/Drupal/Core/Mail/PhpMail.php +++ b/core/lib/Drupal/Core/Mail/PhpMail.php @@ -71,7 +71,7 @@ public function mail(array $message) { // but some MTAs incorrectly replace LF with CRLF. See #234403. $mail_headers = join("\n", $mimeheaders); - $request = \Drupal::request(); + $request = \\Drupal::request(); // We suppress warnings and notices from mail() because of issues on some // hosts. The return value of this method will still indicate whether mail diff --git a/core/lib/Drupal/Core/Mail/VariableLog.php b/core/lib/Drupal/Core/Mail/VariableLog.php index c7b5201..a5467fe 100644 --- a/core/lib/Drupal/Core/Mail/VariableLog.php +++ b/core/lib/Drupal/Core/Mail/VariableLog.php @@ -21,9 +21,9 @@ class VariableLog extends PhpMail implements MailInterface { * Accepts an e-mail message and store it in a variable. */ public function mail(array $message) { - $captured_emails = \Drupal::state()->get('system.test_email_collector') ?: array(); + $captured_emails = \\Drupal::state()->get('system.test_email_collector') ?: array(); $captured_emails[] = $message; - \Drupal::state()->set('system.test_email_collector', $captured_emails); + \\Drupal::state()->set('system.test_email_collector', $captured_emails); return TRUE; } diff --git a/core/lib/Drupal/Core/Plugin/Context/Context.php b/core/lib/Drupal/Core/Plugin/Context/Context.php index fbdf658..e2807cf 100644 --- a/core/lib/Drupal/Core/Plugin/Context/Context.php +++ b/core/lib/Drupal/Core/Plugin/Context/Context.php @@ -49,7 +49,7 @@ public function getContextValue() { public function setContextValue($value) { // Make sure the value set is a typed data object. if (!empty($this->contextDefinition['type']) && !$value instanceof TypedDataInterface) { - $value = \Drupal::typedData()->create($this->contextDefinition, $value); + $value = \\Drupal::typedData()->create($this->contextDefinition, $value); } parent::setContextValue($value); } diff --git a/core/lib/Drupal/Core/Plugin/Discovery/AlterDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/AlterDecorator.php index c81894e..3369307 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/AlterDecorator.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/AlterDecorator.php @@ -56,7 +56,7 @@ public function getDefinition($plugin_id) { */ public function getDefinitions() { $definitions = $this->decorated->getDefinitions(); - \Drupal::moduleHandler()->alter($this->hook, $definitions); + \\Drupal::moduleHandler()->alter($this->hook, $definitions); return $definitions; } diff --git a/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php index fcae2e3..5f24ee5 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php @@ -22,7 +22,7 @@ protected function getDerivativeFetcher($base_plugin_id, array $base_definition) // If the derivative class provides a factory method, pass the container // to it. if (is_subclass_of($class, 'Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface')) { - $this->derivativeFetchers[$base_plugin_id] = $class::create(\Drupal::getContainer(), $base_plugin_id); + $this->derivativeFetchers[$base_plugin_id] = $class::create(\\Drupal::getContainer(), $base_plugin_id); } else { $this->derivativeFetchers[$base_plugin_id] = new $class($base_plugin_id); diff --git a/core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php index dce1741..374ec8c 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php @@ -45,7 +45,7 @@ public function getDefinition($plugin_id) { */ public function getDefinitions() { $definitions = array(); - foreach (\Drupal::moduleHandler()->getImplementations($this->hook) as $module) { + foreach (\\Drupal::moduleHandler()->getImplementations($this->hook) as $module) { $function = $module . '_' . $this->hook; foreach ($function() as $plugin_id => $definition) { $definition['module'] = $module; diff --git a/core/lib/Drupal/Core/Plugin/Discovery/InfoHookDecorator.php b/core/lib/Drupal/Core/Plugin/Discovery/InfoHookDecorator.php index 8f59989..cc6545b 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/InfoHookDecorator.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/InfoHookDecorator.php @@ -54,7 +54,7 @@ public function getDefinition($plugin_id) { */ public function getDefinitions() { $definitions = $this->decorated->getDefinitions(); - foreach (\Drupal::moduleHandler()->getImplementations($this->hook) as $module) { + foreach (\\Drupal::moduleHandler()->getImplementations($this->hook) as $module) { $function = $module . '_' . $this->hook; $function($definitions); } diff --git a/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php b/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php index 0990565..bbf763c 100644 --- a/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php +++ b/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php @@ -22,7 +22,7 @@ public function createInstance($plugin_id, array $configuration) { // If the plugin provides a factory method, pass the container to it. if (is_subclass_of($plugin_class, 'Drupal\Core\Plugin\ContainerFactoryPluginInterface')) { - return $plugin_class::create(\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition); + return $plugin_class::create(\\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition); } // Otherwise, create the plugin directly. diff --git a/core/lib/Drupal/Core/Session/UserSession.php b/core/lib/Drupal/Core/Session/UserSession.php index af33674..d2dc058 100644 --- a/core/lib/Drupal/Core/Session/UserSession.php +++ b/core/lib/Drupal/Core/Session/UserSession.php @@ -128,7 +128,7 @@ public function hasPermission($permission) { return TRUE; } - $roles = \Drupal::entityManager()->getStorageController('user_role')->loadMultiple($this->getRoles()); + $roles = \\Drupal::entityManager()->getStorageController('user_role')->loadMultiple($this->getRoles()); foreach ($roles as $role) { if ($role->hasPermission($permission)) { @@ -204,8 +204,8 @@ function getPreferredAdminLangcode($default = NULL) { * {@inheritdoc} */ public function getUsername() { - $name = $this->name ?: \Drupal::config('user.settings')->get('anonymous'); - \Drupal::moduleHandler()->alter('user_format_name', $name, $this); + $name = $this->name ?: \\Drupal::config('user.settings')->get('anonymous'); + \\Drupal::moduleHandler()->alter('user_format_name', $name, $this); return $name; } diff --git a/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php b/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php index 39b3f28..490e9e5 100644 --- a/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php +++ b/core/lib/Drupal/Core/StreamWrapper/PrivateStream.php @@ -19,7 +19,7 @@ class PrivateStream extends LocalStream { * Implements Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath() */ public function getDirectoryPath() { - return \Drupal::config('system.file')->get('path.private'); + return \\Drupal::config('system.file')->get('path.private'); } /** diff --git a/core/lib/Drupal/Core/SystemListingInfo.php b/core/lib/Drupal/Core/SystemListingInfo.php index 714365b..3d556c3 100644 --- a/core/lib/Drupal/Core/SystemListingInfo.php +++ b/core/lib/Drupal/Core/SystemListingInfo.php @@ -29,7 +29,7 @@ protected function profiles($directory) { // distribution we need to include the profile of the parent site (in // which test runs are triggered). if (drupal_valid_test_ua() && !drupal_installation_attempted()) { - $testing_profile = \Drupal::config('simpletest.settings')->get('parent_profile'); + $testing_profile = \\Drupal::config('simpletest.settings')->get('parent_profile'); if ($testing_profile && $testing_profile != $profile) { $searchdir[] = drupal_get_path('profile', $testing_profile) . '/' . $directory; } @@ -61,7 +61,7 @@ protected function process(array $files, array $files_to_add) { // If the module or theme is incompatible with Drupal core, remove it // from the array for the current search directory, so it is not // overwritten when merged with the $files array. - if (isset($info['core']) && $info['core'] != \Drupal::CORE_COMPATIBILITY) { + if (isset($info['core']) && $info['core'] != \\Drupal::CORE_COMPATIBILITY) { unset($files_to_add[$file_key]); } } diff --git a/core/lib/Drupal/Core/TypedData/Annotation/DataType.php b/core/lib/Drupal/Core/TypedData/Annotation/DataType.php index c0569ab..f15bb12 100644 --- a/core/lib/Drupal/Core/TypedData/Annotation/DataType.php +++ b/core/lib/Drupal/Core/TypedData/Annotation/DataType.php @@ -28,7 +28,7 @@ * type, is ordered and may contain duplicates. The classed used for a list of * items of a certain type may be specified using the 'list class' key. * - * @see \Drupal::typedData() + * @see \\Drupal::typedData() * @see Drupal\Core\TypedData\TypedDataManager::create() * @see hook_data_type_info_alter() * diff --git a/core/lib/Drupal/Core/TypedData/DataReferenceBase.php b/core/lib/Drupal/Core/TypedData/DataReferenceBase.php index 8e67a24..0aaed26 100644 --- a/core/lib/Drupal/Core/TypedData/DataReferenceBase.php +++ b/core/lib/Drupal/Core/TypedData/DataReferenceBase.php @@ -43,7 +43,7 @@ public function getValue() { * {@inheritdoc} */ public function setValue($value, $notify = TRUE) { - $this->target = \Drupal::typedData()->create($this->getTargetDefinition(), $value); + $this->target = \\Drupal::typedData()->create($this->getTargetDefinition(), $value); // Notify the parent of any changes. if ($notify && isset($this->parent)) { $this->parent->onChange($this->name); diff --git a/core/lib/Drupal/Core/TypedData/ItemList.php b/core/lib/Drupal/Core/TypedData/ItemList.php index 9b39e83..f125afe 100644 --- a/core/lib/Drupal/Core/TypedData/ItemList.php +++ b/core/lib/Drupal/Core/TypedData/ItemList.php @@ -133,7 +133,7 @@ public function offsetGet($offset) { * @return \Drupal\Core\TypedData\TypedDataInterface */ protected function createItem($offset = 0, $value = NULL) { - return \Drupal::typedData()->getPropertyInstance($this, $offset, $value); + return \\Drupal::typedData()->getPropertyInstance($this, $offset, $value); } /** diff --git a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php index 180003c..c8d917b 100644 --- a/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php +++ b/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php @@ -122,7 +122,7 @@ public function get($property_name) { $value = $this->values[$property_name]; } // If the property is unknown, this will throw an exception. - $this->properties[$property_name] = \Drupal::typedData()->getPropertyInstance($this, $property_name, $value); + $this->properties[$property_name] = \\Drupal::typedData()->getPropertyInstance($this, $property_name, $value); } return $this->properties[$property_name]; } diff --git a/core/lib/Drupal/Core/TypedData/TypedData.php b/core/lib/Drupal/Core/TypedData/TypedData.php index aa873ac..15860a1 100644 --- a/core/lib/Drupal/Core/TypedData/TypedData.php +++ b/core/lib/Drupal/Core/TypedData/TypedData.php @@ -69,7 +69,7 @@ public function getPluginId() { * {@inheritdoc} */ public function getPluginDefinition() { - return \Drupal::typedData()->getDefinition($this->definition['type']); + return \\Drupal::typedData()->getDefinition($this->definition['type']); } /** @@ -109,7 +109,7 @@ public function getString() { */ public function getConstraints() { // @todo: Add the typed data manager as proper dependency. - return \Drupal::typedData()->getConstraints($this->definition); + return \\Drupal::typedData()->getConstraints($this->definition); } /** @@ -117,7 +117,7 @@ public function getConstraints() { */ public function validate() { // @todo: Add the typed data manager as proper dependency. - return \Drupal::typedData()->getValidator()->validate($this); + return \\Drupal::typedData()->getValidator()->validate($this); } /** diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManager.php b/core/lib/Drupal/Core/TypedData/TypedDataManager.php index 0e786bd..3d6d2dc 100644 --- a/core/lib/Drupal/Core/TypedData/TypedDataManager.php +++ b/core/lib/Drupal/Core/TypedData/TypedDataManager.php @@ -138,7 +138,7 @@ public function createInstance($plugin_id, array $configuration, $name = NULL, $ * @return \Drupal\Core\TypedData\TypedDataInterface * The instantiated typed data object. * - * @see \Drupal::typedData() + * @see \\Drupal::typedData() * @see \Drupal\Core\TypedData\TypedDataManager::getPropertyInstance() * @see \Drupal\Core\TypedData\Plugin\DataType\Integer * @see \Drupal\Core\TypedData\Plugin\DataType\Float 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/lib/Drupal/Core/Utility/SchemaCache.php b/core/lib/Drupal/Core/Utility/SchemaCache.php index 4e3bdd4..6bfa9e6 100644 --- a/core/lib/Drupal/Core/Utility/SchemaCache.php +++ b/core/lib/Drupal/Core/Utility/SchemaCache.php @@ -18,7 +18,7 @@ class SchemaCache extends CacheArray { * Constructs a SchemaCache object. */ public function __construct() { - $request = \Drupal::request(); + $request = \\Drupal::request(); // Cache by request method. parent::__construct('schema:runtime:' . ($request->isMethod('GET')), 'cache', array('schema' => TRUE)); } diff --git a/core/lib/Drupal/Core/Utility/ThemeRegistry.php b/core/lib/Drupal/Core/Utility/ThemeRegistry.php index 9263e51..71a1c69 100644 --- a/core/lib/Drupal/Core/Utility/ThemeRegistry.php +++ b/core/lib/Drupal/Core/Utility/ThemeRegistry.php @@ -50,7 +50,7 @@ function __construct($cid, $bin, $tags, $modules_loaded = FALSE) { $this->cid = $cid; $this->bin = $bin; $this->tags = $tags; - $request = \Drupal::request(); + $request = \\Drupal::request(); $this->persistable = $modules_loaded && $request->isMethod('GET'); if ($this->persistable && $cached = cache($this->bin)->get($this->cid)) { diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php index 7ad2cfd..0c8b386 100644 --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/AllowedValuesConstraintValidator.php @@ -21,7 +21,7 @@ class AllowedValuesConstraintValidator extends ChoiceValidator { */ public function validate($value, Constraint $constraint) { if ($this->context->getMetadata()->getTypedData() instanceof AllowedValuesInterface) { - $account = \Drupal::currentUser(); + $account = \\Drupal::currentUser(); $allowed_values = $this->context->getMetadata()->getTypedData()->getSettableValues($account); $constraint->choices = $allowed_values; } diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraint.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraint.php index 5eb7f35..093c71e 100644 --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraint.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ComplexDataConstraint.php @@ -39,7 +39,7 @@ public function __construct($options = NULL) { $options = array('properties' => $options); } parent::__construct($options); - $constraint_manager = \Drupal::service('validation.constraint'); + $constraint_manager = \\Drupal::service('validation.constraint'); // Instantiate constraint objects for array definitions. foreach ($this->properties as &$constraints) { diff --git a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php index 79ce7c9..6429999 100644 --- a/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php +++ b/core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/EntityChangedConstraintValidator.php @@ -23,7 +23,7 @@ public function validate($value, Constraint $constraint) { if (isset($value)) { $entity = $this->context->getMetadata()->getTypedData()->getEntity(); if (!$entity->isNew()) { - $saved_entity = \Drupal::entityManager()->getStorageController($entity->entityType())->loadUnchanged($entity->id()); + $saved_entity = \\Drupal::entityManager()->getStorageController($entity->entityType())->loadUnchanged($entity->id()); if ($saved_entity && ($saved_entity instanceof EntityChangedInterface) && ($saved_entity->getChangedTime() > $value)) { $this->context->addViolation($constraint->message); diff --git a/core/modules/action/lib/Drupal/action/Tests/ActionUninstallTest.php b/core/modules/action/lib/Drupal/action/Tests/ActionUninstallTest.php index 01b125d..2e91f6a 100644 --- a/core/modules/action/lib/Drupal/action/Tests/ActionUninstallTest.php +++ b/core/modules/action/lib/Drupal/action/Tests/ActionUninstallTest.php @@ -35,8 +35,8 @@ public static function getInfo() { * Tests Action uninstall. */ public function testActionUninstall() { - \Drupal::moduleHandler()->disable(array('action')); - \Drupal::moduleHandler()->uninstall(array('action')); + \\Drupal::moduleHandler()->disable(array('action')); + \\Drupal::moduleHandler()->uninstall(array('action')); $this->assertTrue(entity_load('action', 'user_block_user_action', TRUE), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.' ); 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/aggregator/lib/Drupal/aggregator/Entity/Feed.php b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php index 610d474..e155967 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Entity/Feed.php @@ -181,7 +181,7 @@ public function label($langcode = NULL) { * {@inheritdoc} */ public function removeItems() { - $manager = \Drupal::service('plugin.manager.aggregator.processor'); + $manager = \\Drupal::service('plugin.manager.aggregator.processor'); foreach ($manager->getDefinitions() as $id => $definition) { $manager->createInstance($id)->remove($this); } @@ -209,13 +209,13 @@ public static function preCreate(EntityStorageControllerInterface $storage_contr */ public static function preDelete(EntityStorageControllerInterface $storage_controller, array $entities) { // Invalidate the block cache to update aggregator feed-based derivatives. - if (\Drupal::moduleHandler()->moduleExists('block')) { - \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); + if (\\Drupal::moduleHandler()->moduleExists('block')) { + \\Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } $storage_controller->deleteCategories($entities); foreach ($entities as $entity) { // Notify processors to remove stored items. - $manager = \Drupal::service('plugin.manager.aggregator.processor'); + $manager = \\Drupal::service('plugin.manager.aggregator.processor'); foreach ($manager->getDefinitions() as $id => $definition) { $manager->createInstance($id)->remove($entity); } @@ -230,7 +230,7 @@ public static function postDelete(EntityStorageControllerInterface $storage_cont // Make sure there is no active block for this feed. $block_configs = config_get_storage_names_with_prefix('plugin.core.block'); foreach ($block_configs as $config_id) { - $config = \Drupal::config($config_id); + $config = \\Drupal::config($config_id); if ($config->get('id') == 'aggregator_feed_block:' . $entity->id()) { $config->delete(); } @@ -259,7 +259,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ * Invalidate the block cache to update aggregator feed-based derivatives. */ protected function clearBlockCacheDefinitions() { - if ($block_manager = \Drupal::getContainer()->get('plugin.manager.block', Container::NULL_ON_INVALID_REFERENCE)) { + if ($block_manager = \\Drupal::getContainer()->get('plugin.manager.block', Container::NULL_ON_INVALID_REFERENCE)) { $block_manager->clearCachedDefinitions(); } } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php index 9b2bcb0..c2ffd08 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Plugin/aggregator/parser/DefaultParser.php @@ -33,7 +33,7 @@ class DefaultParser implements ParserInterface { */ public function parse(Feed $feed) { // Set our bridge extension manager to Zend Feed. - Reader::setExtensionManager(\Drupal::service('feed.bridge.reader')); + Reader::setExtensionManager(\\Drupal::service('feed.bridge.reader')); try { $channel = Reader::importString($feed->source_string); } diff --git a/core/modules/ban/lib/Drupal/ban/Tests/IpAddressBlockingTest.php b/core/modules/ban/lib/Drupal/ban/Tests/IpAddressBlockingTest.php index 0e5cacf..fd0e7e7 100644 --- a/core/modules/ban/lib/Drupal/ban/Tests/IpAddressBlockingTest.php +++ b/core/modules/ban/lib/Drupal/ban/Tests/IpAddressBlockingTest.php @@ -78,7 +78,7 @@ function testIPAddressValidation() { // manually. // TODO: On some systems this test fails due to a bug/inconsistency in cURL. // $edit = array(); - // $edit['ip'] = \Drupal::request()->getClientIP(); + // $edit['ip'] = \\Drupal::request()->getClientIP(); // $this->drupalPostForm('admin/config/people/ban', $edit, t('Save')); // $this->assertText(t('You may not ban your own IP address.')); } 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/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php index d64e3de..ff749c5 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/CustomBlockFormController.php @@ -187,7 +187,7 @@ public function save(array $form, array &$form_state) { $form_state['redirect'] = 'admin/structure/block/add/custom_block:' . $block->uuid->value . '/' . $theme; } else { - $form_state['redirect'] = 'admin/structure/block/add/custom_block:' . $block->uuid->value . '/' . \Drupal::config('system.theme')->get('default'); + $form_state['redirect'] = 'admin/structure/block/add/custom_block:' . $block->uuid->value . '/' . \\Drupal::config('system.theme')->get('default'); } } else { @@ -210,7 +210,7 @@ public function save(array $form, array &$form_state) { */ public function delete(array $form, array &$form_state) { $destination = array(); - $query = \Drupal::request()->query; + $query = \\Drupal::request()->query; if (!is_null($query->get('destination'))) { $destination = drupal_get_destination(); $query->remove('destination'); @@ -225,7 +225,7 @@ public function delete(array $form, array &$form_state) { public function validateForm(array &$form, array &$form_state) { if ($this->entity->isNew()) { // @todo Inject this once https://drupal.org/node/2060865 is in. - $exists = \Drupal::entityManager()->getStorageController('custom_block')->loadByProperties(array('info' => $form_state['values']['info'])); + $exists = \\Drupal::entityManager()->getStorageController('custom_block')->loadByProperties(array('info' => $form_state['values']['info'])); if (!empty($exists)) { form_set_error('info', t('A block with description %name already exists.', array( '%name' => $form_state['values']['info'] diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php index 2f376d9..cbf05f6 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlock.php @@ -200,7 +200,7 @@ public function preSave(EntityStorageControllerInterface $storage_controller) { */ public function postSave(EntityStorageControllerInterface $storage_controller, $update = TRUE) { // Invalidate the block cache to update custom block-based derivatives. - \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); + \\Drupal::service('plugin.manager.block')->clearCachedDefinitions(); } /** diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php index 1e78c6d..43084a5 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockCreationTest.php @@ -154,7 +154,7 @@ public function testBlockDelete() { 'region' => 'sidebar_first', ); $block = entity_load('custom_block', 1); - $url = 'admin/structure/block/add/custom_block:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default'); + $url = 'admin/structure/block/add/custom_block:' . $block->uuid() . '/' . \\Drupal::config('system.theme')->get('default'); $this->drupalPostForm($url, $instance, t('Save block')); $block = custom_block_load(1); diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php index 092e584..1f2f480 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockFieldTest.php @@ -101,7 +101,7 @@ public function testBlockFields() { ); $this->drupalPostForm(NULL, $edit, t('Save')); $block = entity_load('custom_block', 1); - $url = 'admin/structure/block/add/custom_block:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default'); + $url = 'admin/structure/block/add/custom_block:' . $block->uuid() . '/' . \\Drupal::config('system.theme')->get('default'); // Place the block. $instance = array( 'machine_name' => drupal_strtolower($edit['info']), diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockLoadHooksTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockLoadHooksTest.php index 0d20636..d8e5c51 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockLoadHooksTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockLoadHooksTest.php @@ -57,7 +57,7 @@ public function testHookCustomBlockLoad() { // Now, as part of the same page request, load a set of custom_blocks that contain // both basic and other bundle, and make sure the parameters passed to // custom_block_test_custom_block_load() are correctly updated. - $custom_blocks = entity_load_multiple('custom_block', \Drupal::entityQuery('custom_block')->execute(), TRUE); + $custom_blocks = entity_load_multiple('custom_block', \\Drupal::entityQuery('custom_block')->execute(), TRUE); $loaded_custom_block = end($custom_blocks); $this->assertEqual($loaded_custom_block->custom_block_test_loaded_ids, array( $custom_block1->id->value, diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php index 7fa8b36..6f202c7 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/PageEditTest.php @@ -40,7 +40,7 @@ public function testPageEdit() { $this->drupalPostForm('block/add/basic', $edit, t('Save')); // Check that the block exists in the database. - $blocks = \Drupal::entityQuery('custom_block')->condition('info', $edit['info'])->execute(); + $blocks = \\Drupal::entityQuery('custom_block')->condition('info', $edit['info'])->execute(); $block = entity_load('custom_block', reset($blocks)); $this->assertTrue($block, 'Custom block found in database.'); diff --git a/core/modules/block/lib/Drupal/block/BlockBase.php b/core/modules/block/lib/Drupal/block/BlockBase.php index 7888b7b..b551f7f 100644 --- a/core/modules/block/lib/Drupal/block/BlockBase.php +++ b/core/modules/block/lib/Drupal/block/BlockBase.php @@ -168,7 +168,7 @@ public function getMachineNameSuggestion() { // @todo This is basically the same as what is done in // \Drupal\system\MachineNameController::transliterate(), so it might make // sense to provide a common service for the two. - $transliteration_service = \Drupal::transliteration(); + $transliteration_service = \\Drupal::transliteration(); $transliterated = $transliteration_service->transliterate($admin_label, Language::LANGCODE_DEFAULT, '_'); $replace_pattern = '[^a-z0-9_.]+'; diff --git a/core/modules/block/lib/Drupal/block/BlockPluginBag.php b/core/modules/block/lib/Drupal/block/BlockPluginBag.php index 9bd948d..a1d949a 100644 --- a/core/modules/block/lib/Drupal/block/BlockPluginBag.php +++ b/core/modules/block/lib/Drupal/block/BlockPluginBag.php @@ -57,7 +57,7 @@ protected function initializePlugin($instance_id) { $module = $this->configuration['module']; // Ignore blocks belonging to disabled modules, but re-throw valid // exceptions when the module is enabled and the plugin is misconfigured. - if (!$module || \Drupal::moduleHandler()->moduleExists($module)) { + if (!$module || \\Drupal::moduleHandler()->moduleExists($module)) { throw $e; } } diff --git a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php index b5433e6..26e3e1c 100644 --- a/core/modules/block/lib/Drupal/block/BlockPluginInterface.php +++ b/core/modules/block/lib/Drupal/block/BlockPluginInterface.php @@ -54,7 +54,7 @@ public function build(); * * @todo This doesn't belong here. Move this into a new base class in * http://drupal.org/node/1764380. - * @todo This does not set a value in \Drupal::config(), so the name is confusing. + * @todo This does not set a value in \\Drupal::config(), so the name is confusing. * * @see \Drupal\Component\Plugin\PluginBase::$configuration */ diff --git a/core/modules/block/lib/Drupal/block/Entity/Block.php b/core/modules/block/lib/Drupal/block/Entity/Block.php index e465455..560739a 100644 --- a/core/modules/block/lib/Drupal/block/Entity/Block.php +++ b/core/modules/block/lib/Drupal/block/Entity/Block.php @@ -104,7 +104,7 @@ class Block extends ConfigEntityBase implements BlockInterface { public function __construct(array $values, $entity_type) { parent::__construct($values, $entity_type); - $this->pluginBag = new BlockPluginBag(\Drupal::service('plugin.manager.block'), array($this->plugin), $this->get('settings'), $this->id()); + $this->pluginBag = new BlockPluginBag(\\Drupal::service('plugin.manager.block'), array($this->plugin), $this->get('settings'), $this->id()); } /** diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php index 6206dbb..563719f 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockCacheTest.php @@ -67,7 +67,7 @@ function testCachePerRole() { // Enable our test block. Set some content for it to display. $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalLogin($this->normal_user); $this->drupalGet(''); $this->assertText($current_content, 'Block content displays.'); @@ -75,7 +75,7 @@ function testCachePerRole() { // Change the content, but the cached copy should still be served. $old_content = $current_content; $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalGet(''); $this->assertText($old_content, 'Block is served from the cache.'); @@ -88,7 +88,7 @@ function testCachePerRole() { // Test whether the cached data is served for the correct users. $old_content = $current_content; $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalLogout(); $this->drupalGet(''); $this->assertNoText($old_content, 'Anonymous user does not see content cached per-role for normal user.'); @@ -112,14 +112,14 @@ function testCachePerRole() { function testCacheGlobal() { $this->setCacheMode(DRUPAL_CACHE_GLOBAL); $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalGet(''); $this->assertText($current_content, 'Block content displays.'); $old_content = $current_content; $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalLogout(); $this->drupalGet('user'); @@ -132,7 +132,7 @@ function testCacheGlobal() { function testNoCache() { $this->setCacheMode(DRUPAL_NO_CACHE); $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); // If DRUPAL_NO_CACHE has no effect, the next request would be cached. $this->drupalGet(''); @@ -140,7 +140,7 @@ function testNoCache() { // A cached copy should not be served. $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalGet(''); $this->assertText($current_content, 'DRUPAL_NO_CACHE prevents blocks from being cached.'); } @@ -151,7 +151,7 @@ function testNoCache() { function testCachePerUser() { $this->setCacheMode(DRUPAL_CACHE_PER_USER); $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalLogin($this->normal_user); $this->drupalGet(''); @@ -159,7 +159,7 @@ function testCachePerUser() { $old_content = $current_content; $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalGet(''); $this->assertText($old_content, 'Block is served from per-user cache.'); @@ -179,14 +179,14 @@ function testCachePerUser() { function testCachePerPage() { $this->setCacheMode(DRUPAL_CACHE_PER_PAGE); $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalGet('node'); $this->assertText($current_content, 'Block content displays on the node page.'); $old_content = $current_content; $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); $this->drupalGet('user'); $this->assertNoText($old_content, 'Block content cached for the node page does not show up for the user page.'); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php index 208710e..32c0224 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php @@ -61,10 +61,10 @@ public function testBlockNotInHiddenRegion() { // Enable "block_test_theme" and set it as the default theme. $theme = 'block_test_theme'; theme_enable(array($theme)); - \Drupal::config('system.theme') + \\Drupal::config('system.theme') ->set('default', $theme) ->save(); - \Drupal::service('router.builder')->rebuild(); + \\Drupal::service('router.builder')->rebuild(); menu_router_rebuild(); // Ensure that "block_test_theme" is set as the default theme. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockHtmlIdTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlIdTest.php index c719fbe..ace7f40 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockHtmlIdTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockHtmlIdTest.php @@ -36,7 +36,7 @@ function setUp() { // Make sure the block has some content so it will appear. $current_content = $this->randomName(); - \Drupal::state()->set('block_test.content', $current_content); + \\Drupal::state()->set('block_test.content', $current_content); // Enable our test blocks. $this->drupalPlaceBlock('system_menu_block:tools'); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php index 915e4bb..bf5851d 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockLanguageTest.php @@ -54,7 +54,7 @@ function setUp() { */ public function testLanguageBlockVisibility() { // Check if the visibility setting is available. - $default_theme = \Drupal::config('system.theme')->get('default'); + $default_theme = \\Drupal::config('system.theme')->get('default'); $this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme); $this->assertField('visibility[language][langcodes][en]', 'Language visibility field is visible.'); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php index 1e72237..d9227e8 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockStorageUnitTest.php @@ -88,7 +88,7 @@ protected function createTests() { $this->assertTrue($entity instanceof Block, 'The newly created entity is a Block.'); // Verify all of the block properties. - $actual_properties = \Drupal::config('block.block.stark.test_block')->get(); + $actual_properties = \\Drupal::config('block.block.stark.test_block')->get(); $this->assertTrue(!empty($actual_properties['uuid']), 'The block UUID is set.'); unset($actual_properties['uuid']); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php index cf50e78..ff6bd42 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTemplateSuggestionsUnitTest.php @@ -40,7 +40,7 @@ function testBlockThemeHookSuggestions() { $block = entity_create('block', array( 'plugin' => 'system_menu_block:admin', 'region' => 'footer', - 'id' => \Drupal::config('system.theme')->get('default') . '.machinename', + 'id' => \\Drupal::config('system.theme')->get('default') . '.machinename', )); $variables = array(); diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php index 536a71c..cd0eaa4 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTest.php @@ -30,7 +30,7 @@ function testBlockVisibility() { // Create a random title for the block. $title = $this->randomName(8); // Enable a standard block. - $default_theme = \Drupal::config('system.theme')->get('default'); + $default_theme = \\Drupal::config('system.theme')->get('default'); $edit = array( 'machine_name' => strtolower($this->randomName(8)), 'region' => 'sidebar_first', @@ -71,7 +71,7 @@ function testBlockVisibilityListedEmpty() { // Create a random title for the block. $title = $this->randomName(8); // Enable a standard block. - $default_theme = \Drupal::config('system.theme')->get('default'); + $default_theme = \\Drupal::config('system.theme')->get('default'); $edit = array( 'machine_name' => strtolower($this->randomName(8)), 'region' => 'sidebar_first', @@ -104,7 +104,7 @@ function testBlock() { $block['id'] = 'system_powered_by_block'; $block['settings[label]'] = $this->randomName(8); $block['machine_name'] = strtolower($this->randomName(8)); - $block['theme'] = \Drupal::config('system.theme')->get('default'); + $block['theme'] = \\Drupal::config('system.theme')->get('default'); $block['region'] = 'header'; // Set block title to confirm that interface works and override any custom titles. @@ -214,7 +214,7 @@ function testHideBlockTitle() { */ function moveBlockToRegion(array $block, $region) { // Set the created block to a specific region. - $block += array('theme' => \Drupal::config('system.theme')->get('default')); + $block += array('theme' => \\Drupal::config('system.theme')->get('default')); $edit = array(); $edit['blocks[' . $block['theme'] . '.' . $block['machine_name'] . '][region]'] = $region; $this->drupalPostForm('admin/structure/block', $edit, t('Save blocks')); @@ -248,7 +248,7 @@ function testBlockRehash() { $block = array(); $block['id'] = 'test_cache'; $block['machine_name'] = strtolower($this->randomName(8)); - $block['theme'] = \Drupal::config('system.theme')->get('default'); + $block['theme'] = \\Drupal::config('system.theme')->get('default'); $block['region'] = 'header'; $block = $this->drupalPlaceBlock('test_cache', array('region' => 'header')); @@ -306,7 +306,7 @@ function testBlockModuleDisable() { } // Ensure that the disabled module's block plugin is no longer available. - $this->drupalGet('admin/structure/block/list/' . \Drupal::config('system.theme')->get('default')); + $this->drupalGet('admin/structure/block/list/' . \\Drupal::config('system.theme')->get('default')); $this->assertNoText(t('Test block caching')); // Confirm that the block is no longer displayed on the front page. diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php b/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php index 96ea288..aaddcbc 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTestBase.php @@ -39,7 +39,7 @@ function setUp() { parent::setUp(); // Use the test page as the front page. - \Drupal::config('system.site')->set('page.front', 'test-page')->save(); + \\Drupal::config('system.site')->set('page.front', 'test-page')->save(); // Create Full HTML text format. $full_html_format = entity_create('filter_format', array( @@ -71,7 +71,7 @@ function setUp() { $manager = $this->container->get('plugin.manager.block'); $instances = config_get_storage_names_with_prefix('plugin.core.block.' . $default_theme); foreach ($instances as $plugin_id) { - \Drupal::config($plugin_id)->delete(); + \\Drupal::config($plugin_id)->delete(); } } diff --git a/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php b/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php index f185f58..de26be3 100644 --- a/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/BlockTitleXSSTest.php @@ -39,12 +39,12 @@ protected function setUp() { * Test XSS in title. */ function testXSSInTitle() { - \Drupal::state()->set('block_test.content', $this->randomName()); + \\Drupal::state()->set('block_test.content', $this->randomName()); $this->drupalGet(''); $this->assertNoRaw('', 'The block title was properly sanitized when rendered.'); $this->drupalLogin($this->drupalCreateUser(array('administer blocks', 'access administration pages'))); - $default_theme = \Drupal::config('system.theme')->get('default'); + $default_theme = \\Drupal::config('system.theme')->get('default'); $this->drupalGet('admin/structure/block/list/' . $default_theme); $this->assertNoRaw("", 'The block title was properly sanitized in Block Plugin UI Admin page.'); } diff --git a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php index 00fccc3..0677763 100644 --- a/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/NewDefaultThemeBlocksTest.php @@ -33,7 +33,7 @@ public static function getInfo() { * Check the enabled Bartik blocks are correctly copied over. */ function testNewDefaultThemeBlocks() { - $default_theme = \Drupal::config('system.theme')->get('default'); + $default_theme = \\Drupal::config('system.theme')->get('default'); // Add several block instances. $this->adminUser = $this->drupalCreateUser(array('administer blocks')); @@ -51,7 +51,7 @@ function testNewDefaultThemeBlocks() { $new_theme = 'bartik'; $this->assertFalse($new_theme == $default_theme, 'The new theme is different from the previous default theme.'); theme_enable(array($new_theme)); - \Drupal::config('system.theme') + \\Drupal::config('system.theme') ->set('default', $new_theme) ->save(); diff --git a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php index 1e07586..b083f4a 100644 --- a/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php +++ b/core/modules/block/lib/Drupal/block/Tests/Views/DisplayBlockTest.php @@ -178,7 +178,7 @@ protected function testDeleteBlockDisplay() { */ public function testViewsBlockForm() { $this->drupalLogin($this->drupalCreateUser(array('administer blocks'))); - $default_theme = \Drupal::config('system.theme')->get('default'); + $default_theme = \\Drupal::config('system.theme')->get('default'); $this->drupalGet('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme); $elements = $this->xpath('//input[@name="label"]'); $this->assertTrue(empty($elements), 'The label field is not found for Views blocks.'); diff --git a/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php b/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php index 085343e..13928b4 100644 --- a/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php +++ b/core/modules/block/tests/Drupal/block/Tests/BlockBaseTest.php @@ -45,7 +45,7 @@ public function testGetMachineNameSuggestion() { $container = new ContainerBuilder(); $container->set('transliteration', $transliteraton); - \Drupal::setContainer($container); + \\Drupal::setContainer($container); $config = array(); $definition = array('admin_label' => 'Admin label', 'module' => 'block_test'); 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/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php index c26780a..680677f 100644 --- a/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php +++ b/core/modules/block/tests/modules/block_test/lib/Drupal/block_test/Plugin/Block/TestCacheBlock.php @@ -37,7 +37,7 @@ public function defaultConfiguration() { */ public function build() { return array( - '#children' => \Drupal::state()->get('block_test.content'), + '#children' => \\Drupal::state()->get('block_test.content'), ); } 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..fe3edd5 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,14 +611,14 @@ 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(); - $query = \Drupal::request()->query; + $query = \\Drupal::request()->query; if ($node->isNew() && !is_null($query->get('parent')) && is_numeric($query->get('parent'))) { // Handle "Add child page" links: $parent = book_link_load($query->get('parent')); @@ -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/book/lib/Drupal/book/Tests/BookTest.php b/core/modules/book/lib/Drupal/book/Tests/BookTest.php index 4772dfa..0ee83d4 100644 --- a/core/modules/book/lib/Drupal/book/Tests/BookTest.php +++ b/core/modules/book/lib/Drupal/book/Tests/BookTest.php @@ -434,9 +434,9 @@ function testBookNodeTypeChange() { // 'page', // ); // @endcode - $current_config = \Drupal::config('book.settings')->init()->get(); + $current_config = \\Drupal::config('book.settings')->init()->get(); $this->drupalPostForm('admin/structure/book/settings', array(), t('Save configuration')); - $this->assertIdentical($current_config, \Drupal::config('book.settings')->init()->get()); + $this->assertIdentical($current_config, \\Drupal::config('book.settings')->init()->get()); // Change the name, machine name and description. $edit = array( @@ -455,9 +455,9 @@ function testBookNodeTypeChange() { // 'zebra', // ); // @endcode - $current_config = \Drupal::config('book.settings')->init()->get(); + $current_config = \\Drupal::config('book.settings')->init()->get(); $this->drupalPostForm('admin/structure/book/settings', array(), t('Save configuration')); - $this->assertIdentical($current_config, \Drupal::config('book.settings')->init()->get()); + $this->assertIdentical($current_config, \\Drupal::config('book.settings')->init()->get()); $edit = array( 'name' => 'Animal book', @@ -473,13 +473,13 @@ function testBookNodeTypeChange() { // 'zebra', // ); // @endcode - $current_config = \Drupal::config('book.settings')->init()->get(); + $current_config = \\Drupal::config('book.settings')->init()->get(); $this->drupalPostForm('admin/structure/book/settings', array(), t('Save configuration')); - $this->assertIdentical($current_config, \Drupal::config('book.settings')->init()->get()); + $this->assertIdentical($current_config, \\Drupal::config('book.settings')->init()->get()); // Ensure that after all the node type changes book.settings:child_type has // the expected value. - $this->assertEqual(\Drupal::config('book.settings')->get('child_type'), 'zebra'); + $this->assertEqual(\\Drupal::config('book.settings')->get('child_type'), 'zebra'); } /** 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/color/lib/Drupal/color/Tests/ColorTest.php b/core/modules/color/lib/Drupal/color/Tests/ColorTest.php index 315d85d..91ff2ff 100644 --- a/core/modules/color/lib/Drupal/color/Tests/ColorTest.php +++ b/core/modules/color/lib/Drupal/color/Tests/ColorTest.php @@ -78,7 +78,7 @@ function testColor() { * Tests the Color module functionality using the given theme. */ function _testColor($theme, $test_values) { - \Drupal::config('system.theme') + \\Drupal::config('system.theme') ->set('default', $theme) ->save(); $settings_path = 'admin/appearance/settings/' . $theme; @@ -91,7 +91,7 @@ function _testColor($theme, $test_values) { $this->drupalPostForm($settings_path, $edit, t('Save configuration')); $this->drupalGet(''); - $stylesheets = \Drupal::config('color.' . $theme)->get('stylesheets'); + $stylesheets = \\Drupal::config('color.' . $theme)->get('stylesheets'); $this->assertPattern('|' . file_create_url($stylesheets[0]) . '|', 'Make sure the color stylesheet is included in the content. (' . $theme . ')'); $stylesheet_content = join("\n", file($stylesheets[0])); @@ -103,16 +103,16 @@ function _testColor($theme, $test_values) { $this->drupalPostForm($settings_path, $edit, t('Save configuration')); $this->drupalGet(''); - $stylesheets = \Drupal::config('color.' . $theme)->get('stylesheets'); + $stylesheets = \\Drupal::config('color.' . $theme)->get('stylesheets'); $stylesheet_content = join("\n", file($stylesheets[0])); $this->assertTrue(strpos($stylesheet_content, 'color: ' . $test_values['scheme_color']) !== FALSE, 'Make sure the color we changed is in the color stylesheet. (' . $theme . ')'); // Test with aggregated CSS turned on. - $config = \Drupal::config('system.performance'); + $config = \\Drupal::config('system.performance'); $config->set('css.preprocess', 1); $config->save(); $this->drupalGet(''); - $stylesheets = \Drupal::state()->get('drupal_css_cache_files') ?: array(); + $stylesheets = \\Drupal::state()->get('drupal_css_cache_files') ?: array(); $stylesheet_content = ''; foreach ($stylesheets as $key => $uri) { $stylesheet_content .= join("\n", file(drupal_realpath($uri))); @@ -126,7 +126,7 @@ function _testColor($theme, $test_values) { * Tests whether the provided color is valid. */ function testValidColor() { - \Drupal::config('system.theme') + \\Drupal::config('system.theme') ->set('default', 'bartik') ->save(); $settings_path = 'admin/appearance/settings/bartik'; 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/comment/lib/Drupal/comment/CommentFormController.php b/core/modules/comment/lib/Drupal/comment/CommentFormController.php index 985f900..cef40f7 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentFormController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentFormController.php @@ -91,7 +91,7 @@ public function form(array $form, array &$form_state) { ); if ($is_admin) { $form['author']['name']['#title'] = t('Authored by'); - $form['author']['name']['#description'] = t('Leave blank for %anonymous.', array('%anonymous' => \Drupal::config('user.settings')->get('anonymous'))); + $form['author']['name']['#description'] = t('Leave blank for %anonymous.', array('%anonymous' => \\Drupal::config('user.settings')->get('anonymous'))); $form['author']['name']['#autocomplete_route_name'] = 'user_autocomplete'; } elseif ($user->isAuthenticated()) { @@ -279,7 +279,7 @@ public function submit(array $form, array &$form_state) { // If the comment was posted by an anonymous user and no author name was // required, use "Anonymous" by default. if ($comment->is_anonymous && (!isset($comment->name->value) || $comment->name->value === '')) { - $comment->name->value = \Drupal::config('user.settings')->get('anonymous'); + $comment->name->value = \\Drupal::config('user.settings')->get('anonymous'); } // Validate the comment's subject. If not specified, extract from comment diff --git a/core/modules/comment/lib/Drupal/comment/CommentRenderController.php b/core/modules/comment/lib/Drupal/comment/CommentRenderController.php index f13c8d8..65fbd87 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentRenderController.php +++ b/core/modules/comment/lib/Drupal/comment/CommentRenderController.php @@ -73,7 +73,7 @@ public function buildContent(array $entities, array $displays, $view_mode, $lang $entity->content['#attached'] = array(); } $entity->content['#attached']['library'][] = array('comment', 'drupal.comment-by-viewer'); - if (\Drupal::moduleHandler()->moduleExists('history') && $user->isAuthenticated()) { + if (\\Drupal::moduleHandler()->moduleExists('history') && $user->isAuthenticated()) { $entity->content['#attached']['library'][] = array('comment', 'drupal.comment-new-indicator'); } } diff --git a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php index d46fb3d..1d60dcc 100644 --- a/core/modules/comment/lib/Drupal/comment/Entity/Comment.php +++ b/core/modules/comment/lib/Drupal/comment/Entity/Comment.php @@ -299,7 +299,7 @@ public function preSave(EntityStorageControllerInterface $storage_controller) { } // Add the values which aren't passed into the function. $this->thread->value = $thread; - $this->hostname->value = \Drupal::request()->getClientIP(); + $this->hostname->value = \\Drupal::request()->getClientIP(); } } diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php b/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php index fff8d59..c0c2d70 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/entity_reference/selection/CommentSelection.php @@ -73,7 +73,7 @@ public function entityQueryAlter(SelectInterface $query) { // Passing the query to node_query_node_access_alter() is sadly // insufficient for nodes. // @see SelectionEntityTypeNode::entityQueryAlter() - if (!user_access('bypass node access') && !count(\Drupal::moduleHandler()->getImplementations('node_grants'))) { + if (!user_access('bypass node access') && !count(\\Drupal::moduleHandler()->getImplementations('node_grants'))) { $query->condition($node_alias . '.status', 1); } } diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php index be6c4c3..93f11e6 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/argument/UserUid.php @@ -56,7 +56,7 @@ public static function create(ContainerInterface $container, array $configuratio function title() { if (!$this->argument) { - $title = \Drupal::config('user.settings')->get('anonymous'); + $title = \\Drupal::config('user.settings')->get('anonymous'); } else { $title = $this->database->query('SELECT u.name FROM {users} u WHERE u.uid = :uid', array(':uid' => $this->argument))->fetchField(); diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/views/row/Rss.php b/core/modules/comment/lib/Drupal/comment/Plugin/views/row/Rss.php index df6d13c..b15453e 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/views/row/Rss.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/views/row/Rss.php @@ -97,7 +97,7 @@ public function render($row) { $item_length = $this->options['item_length']; if ($item_length == 'default') { - $item_length = \Drupal::config('system.rss')->get('items.view_mode'); + $item_length = \\Drupal::config('system.rss')->get('items.view_mode'); } // Load the specified comment and its associated node: diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php index c35bc78..dc9143e 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLanguageTest.php @@ -51,7 +51,7 @@ function setUp() { $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type')); // Enable content language negotiation UI. - \Drupal::state()->set('language_test.content_language_type', TRUE); + \\Drupal::state()->set('language_test.content_language_type', TRUE); // Set interface language detection to user and content language detection // to URL. Disable inheritance from interface language to ensure content diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php index 7bb0458..1a07273 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentLinksTest.php @@ -46,7 +46,7 @@ public static function getInfo() { function testCommentLinks() { // Bartik theme alters comment links, so use a different theme. theme_enable(array('stark')); - \Drupal::config('system.theme') + \\Drupal::config('system.theme') ->set('default', 'stark') ->save(); @@ -171,7 +171,7 @@ function setEnvironment(array $info) { } // Change user settings. - \Drupal::config('user.settings')->set('register', $info['user_register'])->save(); + \\Drupal::config('user.settings')->set('register', $info['user_register'])->save(); // Change user permissions. $rid = ($this->loggedInUser ? DRUPAL_AUTHENTICATED_RID : DRUPAL_ANONYMOUS_RID); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php index a5039e6..dcd4c03 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentPreviewTest.php @@ -69,7 +69,7 @@ function testCommentPreview() { // Login as web user and add a signature and a user picture. $this->drupalLogin($this->web_user); - \Drupal::config('user.settings')->set('signatures', 1)->save(); + \\Drupal::config('user.settings')->set('signatures', 1)->save(); $test_signature = $this->randomName(); $edit['signature[value]'] = '' . $test_signature. ''; $image = current($this->drupalGetTestFiles('image')); diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php index 1819b10..30a24b2 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentTokenReplaceTest.php @@ -25,7 +25,7 @@ public static function getInfo() { * Creates a comment, then tests the tokens generated from it. */ function testCommentTokenReplacement() { - $token_service = \Drupal::token(); + $token_service = \\Drupal::token(); $language_interface = language(Language::TYPE_INTERFACE); $url_options = array( 'absolute' => TRUE, diff --git a/core/modules/config/lib/Drupal/config/Controller/ConfigController.php b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php index f3fd089..452a004 100644 --- a/core/modules/config/lib/Drupal/config/Controller/ConfigController.php +++ b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php @@ -74,7 +74,7 @@ public function downloadExport() { $archiver = new ArchiveTar(file_directory_temp() . '/config.tar.gz', 'gz'); $config_dir = config_get_config_directory(); $config_files = array(); - foreach (\Drupal::service('config.storage')->listAll() as $config_name) { + foreach (\\Drupal::service('config.storage')->listAll() as $config_name) { $config_files[] = $config_dir . '/' . $config_name . '.yml'; } $archiver->createModify($config_files, '', config_get_config_directory()); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php index 363b889..bd31a4c 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php @@ -37,7 +37,7 @@ function testCRUD() { $storage = $this->container->get('config.storage'); $name = 'config_test.crud'; - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $this->assertIdentical($config->isNew(), TRUE); // Create a new configuration object. @@ -58,8 +58,8 @@ function testCRUD() { $actual_data = $storage->read($name); $this->assertIdentical($actual_data, array('value' => 'instance-update')); - // Verify a call to \Drupal::config() immediately returns the updated value. - $new_config = \Drupal::config($name); + // Verify a call to \\Drupal::config() immediately returns the updated value. + $new_config = \\Drupal::config($name); $this->assertIdentical($new_config->get(), $config->get()); $this->assertIdentical($config->isNew(), FALSE); @@ -74,8 +74,8 @@ function testCRUD() { $actual_data = $storage->read($name); $this->assertIdentical($actual_data, FALSE); - // Verify \Drupal::config() returns no data. - $new_config = \Drupal::config($name); + // Verify \\Drupal::config() returns no data. + $new_config = \\Drupal::config($name); $this->assertIdentical($new_config->get(), $config->get()); $this->assertIdentical($config->isNew(), TRUE); @@ -88,36 +88,36 @@ function testCRUD() { $actual_data = $storage->read($name); $this->assertIdentical($actual_data, array('value' => 're-created')); - // Verify a call to \Drupal::config() immediately returns the updated value. - $new_config = \Drupal::config($name); + // Verify a call to \\Drupal::config() immediately returns the updated value. + $new_config = \\Drupal::config($name); $this->assertIdentical($new_config->get(), $config->get()); $this->assertIdentical($config->isNew(), FALSE); // Rename the configuration object. $new_name = 'config_test.crud_rename'; $this->container->get('config.factory')->rename($name, $new_name); - $renamed_config = \Drupal::config($new_name); + $renamed_config = \\Drupal::config($new_name); $this->assertIdentical($renamed_config->get(), $config->get()); $this->assertIdentical($renamed_config->isNew(), FALSE); // Ensure that the old configuration object is removed from both the cache // and the configuration storage. - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $this->assertIdentical($config->get(), array()); $this->assertIdentical($config->isNew(), TRUE); // Test renaming when config.factory does not have the object in its static // cache. $name = 'config_test.crud_rename'; - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $new_name = 'config_test.crud_rename_no_cache'; $this->container->get('config.factory')->clearStaticCache()->rename($name, $new_name); - $renamed_config = \Drupal::config($new_name); + $renamed_config = \\Drupal::config($new_name); $this->assertIdentical($renamed_config->get(), $config->get()); $this->assertIdentical($renamed_config->isNew(), FALSE); // Merge data into the configuration object. - $new_config = \Drupal::config($new_name); + $new_config = \\Drupal::config($new_name); $expected_values = array( 'value' => 'herp', '404' => 'derp', @@ -136,7 +136,7 @@ function testNameValidation() { $name = 'nonamespace'; $message = 'Expected ConfigNameException was thrown for a name without a namespace.'; try { - \Drupal::config($name)->save(); + \\Drupal::config($name)->save(); $this->fail($message); } catch (ConfigNameException $e) { @@ -147,7 +147,7 @@ function testNameValidation() { $name = 'config_test.herman_melville.moby_dick_or_the_whale.harper_1851.now_small_fowls_flew_screaming_over_the_yet_yawning_gulf_a_sullen_white_surf_beat_against_its_steep_sides_then_all_collapsed_and_the_great_shroud_of_the_sea_rolled_on_as_it_rolled_five_thousand_years_ago'; $message = 'Expected ConfigNameException was thrown for a name longer than Config::MAX_NAME_LENGTH.'; try { - \Drupal::config($name)->save(); + \\Drupal::config($name)->save(); $this->fail($message); } catch (ConfigNameException $e) { @@ -159,7 +159,7 @@ function testNameValidation() { foreach ($test_characters as $i => $c) { try { $name = 'namespace.object' . $c; - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $config->save(); } catch (ConfigNameException $e) { @@ -174,7 +174,7 @@ function testNameValidation() { $name = 'namespace.object'; $message = 'ConfigNameException was not thrown for a valid object name.'; try { - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $config->save(); $this->pass($message); } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php index b26e7f2..62cad56 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityListTest.php @@ -202,7 +202,7 @@ function testListUI() { $this->drupalPostForm(NULL, $edit, t('Save')); // Ensure that the entity's sort method was called. - $this->assertTrue(\Drupal::state()->get('config_entity_sort'), 'ConfigTest::sort() was called.'); + $this->assertTrue(\\Drupal::state()->get('config_entity_sort'), 'ConfigTest::sort() was called.'); // Confirm that the user is returned to the listing, and verify that the // text of the label and machine name appears in the list (versus elsewhere diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php index 3e2a718..89421c5 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php @@ -181,7 +181,7 @@ function testCRUD() { } // Test config entity prepopulation. - \Drupal::state()->set('config_test.prepopulate', TRUE); + \\Drupal::state()->set('config_test.prepopulate', TRUE); $config_test = entity_create('config_test', array('foo' => 'bar')); $this->assertEqual($config_test->get('foo'), 'baz', 'Initial value correctly populated'); } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php index ef840b3..82096ae 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigFileContentTest.php @@ -52,7 +52,7 @@ function testReadWriteConfig() { $false_key = 'false'; // Attempt to read non-existing configuration. - $config = \Drupal::config($name); + $config = \\Drupal::config($name); // Verify an configuration object is returned. $this->assertEqual($config->getName(), $name); @@ -66,7 +66,7 @@ function testReadWriteConfig() { $this->assertIdentical($data, FALSE); // Add a top level value - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $config->set($key, $value); // Add a nested value @@ -96,7 +96,7 @@ function testReadWriteConfig() { $this->assertTrue($data); // Read top level value - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $this->assertEqual($config->getName(), $name); $this->assertTrue($config, 'Config object created.'); $this->assertEqual($config->get($key), 'bar', 'Top level configuration value found.'); @@ -134,7 +134,7 @@ function testReadWriteConfig() { // Unset a nested value $config->clear($nested_key); $config->save(); - $config = \Drupal::config($name); + $config = \\Drupal::config($name); // Read unset top level value $this->assertNull($config->get($key), 'Top level value unset.'); @@ -143,13 +143,13 @@ function testReadWriteConfig() { $this->assertNull($config->get($nested_key), 'Nested value unset.'); // Create two new configuration files to test listing - $config = \Drupal::config('foo.baz'); + $config = \\Drupal::config('foo.baz'); $config->set($key, $value); $config->save(); // Test chained set()->save() $chained_name = 'biff.bang'; - $config = \Drupal::config($chained_name); + $config = \\Drupal::config($chained_name); $config->set($key, $value)->save(); // Verify the database entry exists from a chained save. @@ -177,7 +177,7 @@ function testReadWriteConfig() { $this->assertEqual($files, array(), 'No files listed with the prefix \'bar\'.'); // Delete the configuration. - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $config->delete(); // Verify the database entry no longer exists. diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php index 737ddf8..7d25631 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportUITest.php @@ -80,10 +80,10 @@ function testImport() { $this->assertText(t('There are no configuration changes.')); // Verify site name has changed. - $this->assertIdentical($new_site_name, \Drupal::config('system.site')->get('name')); + $this->assertIdentical($new_site_name, \\Drupal::config('system.site')->get('name')); // Verify that new config entity exists. - $this->assertIdentical($original_dynamic_data, \Drupal::config($dynamic_name)->get()); + $this->assertIdentical($original_dynamic_data, \\Drupal::config($dynamic_name)->get()); // Verify the cache got cleared. $this->assertTrue(isset($GLOBALS['hook_cache_flush'])); @@ -113,7 +113,7 @@ function testImportLock() { $this->container->get('lock')->release($config_importer_lock); // Verify site name has not changed. - $this->assertNotEqual($new_site_name, \Drupal::config('system.site')->get('name')); + $this->assertNotEqual($new_site_name, \\Drupal::config('system.site')->get('name')); } /** @@ -163,7 +163,7 @@ function testImportDiff() { function prepareSiteNameUpdate($new_site_name) { $staging = $this->container->get('config.storage.staging'); // Create updated configuration object. - $config_data = \Drupal::config('system.site')->get(); + $config_data = \\Drupal::config('system.site')->get(); $config_data['name'] = $new_site_name; $staging->write('system.site', $config_data); } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php index b17c48b..525ecc1 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImporterTest.php @@ -72,10 +72,10 @@ function testNoImport() { $dynamic_name = 'config_test.dynamic.dotted.default'; // Verify the default configuration values exist. - $config = \Drupal::config($dynamic_name); + $config = \\Drupal::config($dynamic_name); $this->assertIdentical($config->get('id'), 'dotted.default'); - // Verify that a bare \Drupal::config() does not involve module APIs. + // Verify that a bare \\Drupal::config() does not involve module APIs. $this->assertFalse(isset($GLOBALS['hook_config_test'])); } @@ -103,7 +103,7 @@ function testDeleted() { $staging = $this->container->get('config.storage.staging'); // Verify the default configuration values exist. - $config = \Drupal::config($dynamic_name); + $config = \\Drupal::config($dynamic_name); $this->assertIdentical($config->get('id'), 'dotted.default'); // Delete the file from the staging directory. @@ -115,7 +115,7 @@ function testDeleted() { // Verify the file has been removed. $this->assertIdentical($storage->read($dynamic_name), FALSE); - $config = \Drupal::config($dynamic_name); + $config = \\Drupal::config($dynamic_name); $this->assertIdentical($config->get('id'), NULL); // Verify that appropriate module API hooks have been invoked. @@ -160,7 +160,7 @@ function testNew() { $this->configImporter->reset()->import(); // Verify the values appeared. - $config = \Drupal::config($dynamic_name); + $config = \\Drupal::config($dynamic_name); $this->assertIdentical($config->get('label'), $original_dynamic_data['label']); // Verify that appropriate module API hooks have been invoked. @@ -199,18 +199,18 @@ function testUpdated() { $staging->write($dynamic_name, $original_dynamic_data); // Verify the active configuration still returns the default values. - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $this->assertIdentical($config->get('foo'), 'bar'); - $config = \Drupal::config($dynamic_name); + $config = \\Drupal::config($dynamic_name); $this->assertIdentical($config->get('label'), 'Default'); // Import. $this->configImporter->reset()->import(); // Verify the values were updated. - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $this->assertIdentical($config->get('foo'), 'beer'); - $config = \Drupal::config($dynamic_name); + $config = \\Drupal::config($dynamic_name); $this->assertIdentical($config->get('label'), 'Updated'); // Verify that the original file content is still the same. diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php index f9c79e3..7ea2345 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php @@ -37,9 +37,9 @@ function testModuleInstallation() { $default_configuration_entity = 'config_test.dynamic.dotted.default'; // Verify that default module config does not exist before installation yet. - $config = \Drupal::config($default_config); + $config = \\Drupal::config($default_config); $this->assertIdentical($config->isNew(), TRUE); - $config = \Drupal::config($default_configuration_entity); + $config = \\Drupal::config($default_configuration_entity); $this->assertIdentical($config->isNew(), TRUE); // Install the test module. @@ -47,9 +47,9 @@ function testModuleInstallation() { $this->installConfig(array('config_test')); // Verify that default module config exists. - $config = \Drupal::config($default_config); + $config = \\Drupal::config($default_config); $this->assertIdentical($config->isNew(), FALSE); - $config = \Drupal::config($default_configuration_entity); + $config = \\Drupal::config($default_configuration_entity); $this->assertIdentical($config->isNew(), FALSE); // Verify that configuration import callback was invoked for the dynamic diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallWebTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallWebTest.php index 5431a96..47a1ed9 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallWebTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallWebTest.php @@ -40,19 +40,19 @@ function testIntegrationModuleReinstallation() { module_enable(array('config_test')); // Verify the configuration does not exist prior to installation. - $config_static = \Drupal::config($default_config); + $config_static = \\Drupal::config($default_config); $this->assertIdentical($config_static->isNew(), TRUE); - $config_entity = \Drupal::config($default_configuration_entity); + $config_entity = \\Drupal::config($default_configuration_entity); $this->assertIdentical($config_entity->isNew(), TRUE); // Install the integration module. module_enable(array('config_integration_test')); // Verify that default module config exists. - $config_static = \Drupal::config($default_config); + $config_static = \\Drupal::config($default_config); $this->assertIdentical($config_static->isNew(), FALSE); $this->assertIdentical($config_static->get('foo'), 'default setting'); - $config_entity = \Drupal::config($default_configuration_entity); + $config_entity = \\Drupal::config($default_configuration_entity); $this->assertIdentical($config_entity->isNew(), FALSE); $this->assertIdentical($config_entity->get('label'), 'Default integration config label'); @@ -61,7 +61,7 @@ function testIntegrationModuleReinstallation() { $config_entity->set('label', 'Customized integration config label')->save(); // @todo FIXME: Setting config keys WITHOUT SAVING retains the changed config - // object in memory. Every new call to \Drupal::config() MUST revert in-memory changes + // object in memory. Every new call to \\Drupal::config() MUST revert in-memory changes // that haven't been saved! // In other words: This test passes even without this reset, but it shouldn't. $this->container->get('config.factory')->reset(); @@ -71,10 +71,10 @@ function testIntegrationModuleReinstallation() { module_enable(array('config_integration_test')); // Verify that customized config exists. - $config_static = \Drupal::config($default_config); + $config_static = \\Drupal::config($default_config); $this->assertIdentical($config_static->isNew(), FALSE); $this->assertIdentical($config_static->get('foo'), 'customized setting'); - $config_entity = \Drupal::config($default_configuration_entity); + $config_entity = \\Drupal::config($default_configuration_entity); $this->assertIdentical($config_entity->isNew(), FALSE); $this->assertIdentical($config_entity->get('label'), 'Customized integration config label'); @@ -83,11 +83,11 @@ function testIntegrationModuleReinstallation() { module_uninstall(array('config_integration_test')); // Verify the integration module's config was uninstalled. - $config_static = \Drupal::config($default_config); + $config_static = \\Drupal::config($default_config); $this->assertIdentical($config_static->isNew(), TRUE); // Verify the integration config still exists. - $config_entity = \Drupal::config($default_configuration_entity); + $config_entity = \\Drupal::config($default_configuration_entity); $this->assertIdentical($config_entity->isNew(), FALSE); $this->assertIdentical($config_entity->get('label'), 'Customized integration config label'); @@ -95,12 +95,12 @@ function testIntegrationModuleReinstallation() { module_enable(array('config_integration_test')); // Verify the integration module's config was re-installed. - $config_static = \Drupal::config($default_config); + $config_static = \\Drupal::config($default_config); $this->assertIdentical($config_static->isNew(), FALSE); $this->assertIdentical($config_static->get('foo'), 'default setting'); // Verify the customized integration config still exists. - $config_entity = \Drupal::config($default_configuration_entity); + $config_entity = \\Drupal::config($default_configuration_entity); $this->assertIdentical($config_entity->isNew(), FALSE); $this->assertIdentical($config_entity->get('label'), 'Customized integration config label'); } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php b/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php index f3f3ea6..9d85ca1 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverride.php @@ -43,19 +43,19 @@ public function setUp() { function testConfigLocaleOverride() { $name = 'config_test.system'; // The default language is en so the config key should be localised. - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $this->assertIdentical($config->get('foo'), 'en bar'); $this->assertIdentical($config->get('404'), 'herp'); // Ensure that we get the expected value when we avoid overrides. config_context_enter('config.context.free'); - $config_admin = \Drupal::config($name); + $config_admin = \\Drupal::config($name); $this->assertIdentical($config_admin->get('foo'), 'bar'); $this->assertIdentical($config_admin->get('404'), 'herp'); // Leave the non override context. config_context_leave(); - $config = \Drupal::config($name); + $config = \\Drupal::config($name); $this->assertIdentical($config->get('foo'), 'en bar'); $this->assertIdentical($config->get('404'), 'herp'); } @@ -90,7 +90,7 @@ function testConfigLocaleUserOverride() { $user_config_context = config_context_enter('Drupal\user\UserConfigContext'); $user_config_context->setAccount($account); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'fr bar'); // Ensure the non-overriden value is still the same. $this->assertIdentical($config->get('404'), 'herp'); @@ -100,7 +100,7 @@ function testConfigLocaleUserOverride() { // in a user based language override context, the English language override // applies due to the negotiated language for the page. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); $account = entity_create('user', array( @@ -111,11 +111,11 @@ function testConfigLocaleUserOverride() { 'preferred_langcode' => 'de', )); - $config_factory = \Drupal::service('config.factory'); + $config_factory = \\Drupal::service('config.factory'); $config_factory->enterContext($user_config_context->setAccount($account)); // Should not have to re-initialize the configuration object to get new // overrides as the new context will have a different uuid. - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'de bar'); // Enter an english context on top of the german context. @@ -129,24 +129,24 @@ function testConfigLocaleUserOverride() { // Create a new user config context to stack on top of the existign one. $en_user_config_context = config_context_enter('Drupal\user\UserConfigContext'); $en_user_config_context->setAccount($account); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); // Ensure that we get the expected value when we leave the english user // context. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'de bar'); // Ensure that we get the expected value when we leave the german user // context. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); // Ensure that we cannot leave the default context. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); } @@ -172,7 +172,7 @@ function testConfigLocaleLanguageOverride() { $language = language_load('fr'); $language_config_context = config_context_enter('Drupal\language\LanguageConfigContext'); $language_config_context->setLanguage($language); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'fr bar'); // Ensure the non-overridden value is still the same. $this->assertIdentical($config->get('404'), 'herp'); @@ -182,15 +182,15 @@ function testConfigLocaleLanguageOverride() { // in a language override context, the English language override // applies due to the negotiated language for the page. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); - $config_factory = \Drupal::service('config.factory'); + $config_factory = \\Drupal::service('config.factory'); $language = language_load('de'); $config_factory->enterContext($language_config_context->setLanguage($language)); // Should not have to re-initialize the configuration object to get new // overrides as the new context will have a different uuid. - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'de bar'); // Enter an english context on top of the german context. @@ -198,24 +198,24 @@ function testConfigLocaleLanguageOverride() { // Create a new language config context to stack on top of the existing one. $en_language_config_context = config_context_enter('Drupal\language\LanguageConfigContext'); $en_language_config_context->setLanguage($language); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); // Ensure that we get the expected value when we leave the english // language context. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'de bar'); // Ensure that we get the expected value when we leave the german // language context. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); // Ensure that we cannot leave the default context. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); } @@ -249,7 +249,7 @@ function testConfigLocaleUserAndGlobalOverride() { $user_config_context = config_context_enter('Drupal\user\UserConfigContext'); $user_config_context->setAccount($account); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'fr bar'); // Ensure the value overriden from global $conf works. $this->assertIdentical($config->get('404'), 'global herp'); @@ -259,21 +259,21 @@ function testConfigLocaleUserAndGlobalOverride() { // in a user based language override context, the English language override // applies due to the negotiated language for the page. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); // Global override should still apply. $this->assertIdentical($config->get('404'), 'global herp'); // Ensure that we cannot leave the default context. config_context_leave(); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), 'en bar'); // Global override should still apply. $this->assertIdentical($config->get('404'), 'global herp'); // Ensure that we get the expected value when we avoid overrides. config_context_enter('config.context.free'); - $config_admin = \Drupal::config('config_test.system'); + $config_admin = \\Drupal::config('config_test.system'); // Language override should not apply anymore. $this->assertIdentical($config_admin->get('foo'), 'bar'); // Global override should not apply. diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverrideWebTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverrideWebTest.php index f98a1e0..614831b 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverrideWebTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigLocaleOverrideWebTest.php @@ -47,7 +47,7 @@ function testSiteNameTranslation() { $this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add custom language')); // Save an override for the XX language. - \Drupal::config('locale.config.xx.system.site')->set('name', 'XX site name')->save(); + \\Drupal::config('locale.config.xx.system.site')->set('name', 'XX site name')->save(); $this->drupalLogout(); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php index a6016c3..d2fb5f9 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigOverrideTest.php @@ -63,7 +63,7 @@ function testConfOverride() { // Enter an override-free context to ensure the original data remains. config_context_enter('config.context.free'); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), $expected_original_data['foo']); $this->assertIdentical($config->get('baz'), $expected_original_data['baz']); $this->assertIdentical($config->get('404'), $expected_original_data['404']); @@ -71,7 +71,7 @@ function testConfOverride() { // Get the configuration object in an overriden context (the one set by // default). - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); // Verify that it contains the overridden data from $conf. $this->assertIdentical($config->get('foo'), $conf['config_test.system']['foo']); @@ -95,14 +95,14 @@ function testConfOverride() { $config->save(); // Reload it and verify that it still contains overridden data from $conf. - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), $conf['config_test.system']['foo']); $this->assertIdentical($config->get('baz'), $conf['config_test.system']['baz']); $this->assertIdentical($config->get('404'), $conf['config_test.system']['404']); // Enter an override-free context to ensure the original data remains saved. config_context_enter('config.context.free'); - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), $expected_original_data['foo']); $this->assertIdentical($config->get('baz'), $expected_original_data['baz']); $this->assertIdentical($config->get('404'), $expected_original_data['404']); @@ -127,7 +127,7 @@ function testConfOverride() { $this->assertIdentical($data['404'], $expected_new_data['404']); // Verifiy the overrides are still working. - $config = \Drupal::config('config_test.system'); + $config = \\Drupal::config('config_test.system'); $this->assertIdentical($config->get('foo'), $conf['config_test.system']['foo']); $this->assertIdentical($config->get('baz'), $conf['config_test.system']['baz']); $this->assertIdentical($config->get('404'), $conf['config_test.system']['404']); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigSnapshotTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigSnapshotTest.php index d9504b2..f658587 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigSnapshotTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigSnapshotTest.php @@ -66,7 +66,7 @@ function testSnapshot() { $this->assertFalse($active_snapshot_comparer->reset()->hasChanges()); // Change a configuration value in staging. - $staging_data = \Drupal::config($config_name)->get(); + $staging_data = \\Drupal::config($config_name)->get(); $staging_data[$config_key] = $new_data; $staging->write($config_name, $staging_data); @@ -79,7 +79,7 @@ function testSnapshot() { $this->configImporter()->import(); // Verify changed config was properly imported. - $this->assertIdentical(\Drupal::config($config_name)->get($config_key), $new_data); + $this->assertIdentical(\\Drupal::config($config_name)->get($config_key), $new_data); // Verify that a new snapshot was created which and that it matches // the active config. diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigUpgradeTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigUpgradeTest.php index e95f134..03a21c3 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigUpgradeTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigUpgradeTest.php @@ -59,7 +59,7 @@ function testConfigurationUpdate() { )); // Verify that variables have been converted and default values exist. - $config = \Drupal::config('config_upgrade.test'); + $config = \\Drupal::config('config_upgrade.test'); $this->assertIdentical($config->get('foo'), $this->testContent); $this->assertIdentical($config->get('parent.bar'), $this->testContent); $this->assertIdentical($config->get('parent.baz'), 'Baz'); @@ -80,7 +80,7 @@ function testConfigurationUpdate() { )); // Verify that new variables have been converted and existing still exist. - $config = \Drupal::config('config_upgrade.test'); + $config = \\Drupal::config('config_upgrade.test'); $this->assertIdentical($config->get('foo'), $this->testContent); $this->assertIdentical($config->get('parent.bar'), $this->testContent); $this->assertIdentical($config->get('parent.baz'), 'Baz'); @@ -101,7 +101,7 @@ function testConfigurationUpdate() { // For this test it is essential that update_variables_to_config has already // run on the config object. - \Drupal::config('config_upgrade.test') + \\Drupal::config('config_upgrade.test') ->set('numeric_keys.403', '') ->set('numeric_keys.404', '') ->save(); @@ -118,6 +118,6 @@ function testConfigurationUpdate() { 'config_upgrade_404' => 'numeric_keys.404', )); - $this->assertIdentical(\Drupal::config('config_upgrade.test')->get('numeric_keys'), array(403 => 'custom403', 404 => 'custom404')); + $this->assertIdentical(\\Drupal::config('config_upgrade.test')->get('numeric_keys'), array(403 => 'custom403', 404 => 'custom404')); } } diff --git a/core/modules/config/lib/Drupal/config/Tests/Storage/FileStorageTest.php b/core/modules/config/lib/Drupal/config/Tests/Storage/FileStorageTest.php index 60ce433..a5744c4 100644 --- a/core/modules/config/lib/Drupal/config/Tests/Storage/FileStorageTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/Storage/FileStorageTest.php @@ -28,7 +28,7 @@ function setUp() { $this->invalidStorage = new FileStorage($this->configDirectories[CONFIG_ACTIVE_DIRECTORY] . '/nonexisting'); // FileStorage::listAll() requires other configuration data to exist. - $this->storage->write('system.performance', \Drupal::config('system.performance')->get()); + $this->storage->write('system.performance', \\Drupal::config('system.performance')->get()); } protected function read($name) { 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/config/tests/config_test/lib/Drupal/config_test/ConfigTestController.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestController.php index 7b4d95e..0969213 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestController.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/ConfigTestController.php @@ -28,7 +28,7 @@ class ConfigTestController { */ public function edit(ConfigTest $config_test) { drupal_set_title(String::format('Edit %label', array('%label' => $config_test->label())), PASS_THROUGH); - return \Drupal::entityManager()->getForm($config_test); + return \\Drupal::entityManager()->getForm($config_test); } /** diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php index c355e25..86f64e9 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php @@ -100,7 +100,7 @@ public function getExportProperties() { * Overrides \Drupal\Core\Config\Entity\ConfigEntityBase::sort(). */ public static function sort($a, $b) { - \Drupal::state()->set('config_entity_sort', TRUE); + \\Drupal::state()->set('config_entity_sort', TRUE); return parent::sort($a, $b); } 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/contact/lib/Drupal/contact/CategoryFormController.php b/core/modules/contact/lib/Drupal/contact/CategoryFormController.php index bd12a66..d738afe 100644 --- a/core/modules/contact/lib/Drupal/contact/CategoryFormController.php +++ b/core/modules/contact/lib/Drupal/contact/CategoryFormController.php @@ -21,7 +21,7 @@ public function form(array $form, array &$form_state) { $form = parent::form($form, $form_state); $category = $this->entity; - $default_category = \Drupal::config('contact.settings')->get('default_category'); + $default_category = \\Drupal::config('contact.settings')->get('default_category'); $form['label'] = array( '#type' => 'textfield', @@ -108,7 +108,7 @@ public function save(array $form, array &$form_state) { } // Update the default category. - $contact_config = \Drupal::config('contact.settings'); + $contact_config = \\Drupal::config('contact.settings'); if ($form_state['values']['selected']) { $contact_config ->set('default_category', $category->id()) diff --git a/core/modules/contact/lib/Drupal/contact/CategoryListController.php b/core/modules/contact/lib/Drupal/contact/CategoryListController.php index 1e62630..c4734b2 100644 --- a/core/modules/contact/lib/Drupal/contact/CategoryListController.php +++ b/core/modules/contact/lib/Drupal/contact/CategoryListController.php @@ -36,7 +36,7 @@ public function buildRow(EntityInterface $entity) { } else { $row['recipients'] = check_plain(implode(', ', $entity->recipients)); - $default_category = \Drupal::config('contact.settings')->get('default_category'); + $default_category = \\Drupal::config('contact.settings')->get('default_category'); $row['selected'] = ($default_category == $entity->id() ? t('Yes') : t('No')); } return $row + parent::buildRow($entity); diff --git a/core/modules/contact/lib/Drupal/contact/MessageFormController.php b/core/modules/contact/lib/Drupal/contact/MessageFormController.php index d41c959..cd57466 100644 --- a/core/modules/contact/lib/Drupal/contact/MessageFormController.php +++ b/core/modules/contact/lib/Drupal/contact/MessageFormController.php @@ -187,7 +187,7 @@ public function save(array $form, array &$form_state) { drupal_mail('contact', 'page_autoreply', $sender->getEmail(), $language_interface->id, $params); } - \Drupal::service('flood')->register('contact', \Drupal::config('contact.settings')->get('flood.interval')); + \\Drupal::service('flood')->register('contact', \\Drupal::config('contact.settings')->get('flood.interval')); if (!$message->isPersonal()) { watchdog('contact', '%sender-name (@sender-from) sent an e-mail regarding %category.', array( '%sender-name' => $sender->name, diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php index e974ec6..e60847b 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactPersonalTest.php @@ -57,7 +57,7 @@ function setUp() { $this->admin_user = $this->drupalCreateUser(array('administer contact forms', 'administer users', 'administer account settings')); // Create some normal users with their contact forms enabled by default. - \Drupal::config('contact.settings')->set('user_default_enabled', 1)->save(); + \\Drupal::config('contact.settings')->set('user_default_enabled', 1)->save(); $this->web_user = $this->drupalCreateUser(array('access user contact forms')); $this->contact_user = $this->drupalCreateUser(); } @@ -76,7 +76,7 @@ function testSendPersonalContactMessage() { $this->assertEqual($mail['from'], $this->web_user->getEmail()); $this->assertEqual($mail['key'], 'user_mail'); $variables = array( - '!site-name' => \Drupal::config('system.site')->get('name'), + '!site-name' => \\Drupal::config('system.site')->get('name'), '!subject' => $message['subject'], '!recipient-name' => $this->contact_user->getUsername(), ); @@ -170,10 +170,10 @@ function testPersonalContactAccess() { // form. $this->drupalGet('user/' . $this->web_user->id() . '/edit'); $this->assertNoFieldChecked('edit-contact--2'); - $this->assertFalse(\Drupal::service('user.data')->get('contact', $this->web_user->id(), 'enabled'), 'Personal contact form disabled'); + $this->assertFalse(\\Drupal::service('user.data')->get('contact', $this->web_user->id(), 'enabled'), 'Personal contact form disabled'); $this->drupalPostForm(NULL, array('contact' => TRUE), t('Save')); $this->assertFieldChecked('edit-contact--2'); - $this->assertTrue(\Drupal::service('user.data')->get('contact', $this->web_user->id(), 'enabled'), 'Personal contact form enabled'); + $this->assertTrue(\\Drupal::service('user.data')->get('contact', $this->web_user->id(), 'enabled'), 'Personal contact form enabled'); } /** @@ -181,7 +181,7 @@ function testPersonalContactAccess() { */ function testPersonalContactFlood() { $flood_limit = 3; - \Drupal::config('contact.settings')->set('flood.limit', $flood_limit)->save(); + \\Drupal::config('contact.settings')->set('flood.limit', $flood_limit)->save(); // Clear flood table in preparation for flood test and allow other checks to complete. db_delete('flood')->execute(); @@ -198,7 +198,7 @@ function testPersonalContactFlood() { // Submit contact form one over limit. $this->drupalGet('user/' . $this->contact_user->id(). '/contact'); - $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $flood_limit, '@interval' => format_interval(\Drupal::config('contact.settings')->get('flood.interval')))), 'Normal user denied access to flooded contact form.'); + $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $flood_limit, '@interval' => format_interval(\\Drupal::config('contact.settings')->get('flood.interval')))), 'Normal user denied access to flooded contact form.'); // Test that the admin user can still access the contact form even though // the flood limit was reached. diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php index 8a9e210..6a363fc 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactSitewideTest.php @@ -45,7 +45,7 @@ function testSiteWideContact() { $this->drupalLogin($admin_user); $flood_limit = 3; - \Drupal::config('contact.settings') + \\Drupal::config('contact.settings') ->set('flood.limit', $flood_limit) ->set('flood.interval', 600) ->save(); @@ -111,7 +111,7 @@ function testSiteWideContact() { $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); // Check that the category was created in site default language. - $langcode = \Drupal::config('contact.category.' . $id)->get('langcode'); + $langcode = \\Drupal::config('contact.category.' . $id)->get('langcode'); $default_langcode = language_default()->id; $this->assertEqual($langcode, $default_langcode); @@ -120,15 +120,15 @@ function testSiteWideContact() { // Test update contact form category. $this->updateCategory($id, $label = $this->randomName(16), $recipients_str = implode(',', array($recipients[0], $recipients[1])), $reply = $this->randomName(30), FALSE); - $config = \Drupal::config('contact.category.' . $id)->get(); + $config = \\Drupal::config('contact.category.' . $id)->get(); $this->assertEqual($config['label'], $label); $this->assertEqual($config['recipients'], array($recipients[0], $recipients[1])); $this->assertEqual($config['reply'], $reply); - $this->assertNotEqual($id, \Drupal::config('contact.settings')->get('default_category')); + $this->assertNotEqual($id, \\Drupal::config('contact.settings')->get('default_category')); $this->assertRaw(t('Category %label has been updated.', array('%label' => $label))); // Reset the category back to be the default category. - \Drupal::config('contact.settings')->set('default_category', $id)->save(); + \\Drupal::config('contact.settings')->set('default_category', $id)->save(); // Ensure that the contact form is shown without a category selection input. user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form')); @@ -183,7 +183,7 @@ function testSiteWideContact() { $this->assertText(t('Message field is required.')); // Test contact form with no default category selected. - \Drupal::config('contact.settings') + \\Drupal::config('contact.settings') ->set('default_category', '') ->save(); $this->drupalGet('contact'); @@ -203,7 +203,7 @@ function testSiteWideContact() { // Submit contact form one over limit. $this->drupalGet('contact'); $this->assertResponse(403); - $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => \Drupal::config('contact.settings')->get('flood.limit'), '@interval' => format_interval(600)))); + $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => \\Drupal::config('contact.settings')->get('flood.limit'), '@interval' => format_interval(600)))); // Test listing controller. $this->drupalLogin($admin_user); @@ -377,7 +377,7 @@ function submitContact($name, $mail, $subject, $id, $message) { $edit['mail'] = $mail; $edit['subject'] = $subject; $edit['message'] = $message; - if ($id == \Drupal::config('contact.settings')->get('default_category')) { + if ($id == \\Drupal::config('contact.settings')->get('default_category')) { $this->drupalPostForm('contact', $edit, t('Send message')); } else { diff --git a/core/modules/contact/lib/Drupal/contact/Tests/ContactUpgradePathTest.php b/core/modules/contact/lib/Drupal/contact/Tests/ContactUpgradePathTest.php index b5785aa..d6bef89 100644 --- a/core/modules/contact/lib/Drupal/contact/Tests/ContactUpgradePathTest.php +++ b/core/modules/contact/lib/Drupal/contact/Tests/ContactUpgradePathTest.php @@ -60,7 +60,7 @@ public function testContactUpgrade() { $this->assertEqual($contact_category->recipients, array('test1@example.com', 'test2@example.com')); // Ensure that the default category has been maintained. - $this->assertEqual(\Drupal::config('contact.settings')->get('default_category'), $default_contact_category, 'Default category upgraded.'); + $this->assertEqual(\\Drupal::config('contact.settings')->get('default_category'), $default_contact_category, 'Default category upgraded.'); // Check that no default config imported on upgrade. $this->assertFalse(entity_load('contact_category', 'feedback')); 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/content_translation/lib/Drupal/content_translation/ContentTranslationController.php b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php index 7e0b20e..2987308 100644 --- a/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php +++ b/core/modules/content_translation/lib/Drupal/content_translation/ContentTranslationController.php @@ -430,7 +430,7 @@ public function entityFormEntityBuild($entity_type, EntityInterface $entity, arr // Set contextual information that can be reused during the storage phase. // @todo Remove this once translation metadata are converted to regular // fields. - $attributes = \Drupal::request()->attributes; + $attributes = \\Drupal::request()->attributes; $attributes->set('source_langcode', $source_langcode); } 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/datetime/lib/Drupal/datetime/DateHelper.php b/core/modules/datetime/lib/Drupal/datetime/DateHelper.php index 3f8b0f8..b79e189 100644 --- a/core/modules/datetime/lib/Drupal/datetime/DateHelper.php +++ b/core/modules/datetime/lib/Drupal/datetime/DateHelper.php @@ -259,7 +259,7 @@ public static function weekDaysAbbr1($required = FALSE) { * An array of weekdays reordered to match the first day of the week. */ public static function weekDaysOrdered($weekdays) { - $first_day = \Drupal::config('system.date')->get('first_day'); + $first_day = \\Drupal::config('system.date')->get('first_day'); if ($first_day > 0) { for ($i = 1; $i <= $first_day; $i++) { $last = array_shift($weekdays); diff --git a/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php b/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php index da550c7..7503224 100644 --- a/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php +++ b/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php @@ -50,7 +50,7 @@ public function __construct($plugin_id, array $plugin_definition, FieldDefinitio parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings); // @todo Inject this once https://drupal.org/node/2035317 is in. - $this->dateStorage = \Drupal::entityManager()->getStorageController('date_format'); + $this->dateStorage = \\Drupal::entityManager()->getStorageController('date_format'); } /** 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/dblog/lib/Drupal/dblog/Tests/DbLogTest.php b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php index 9f68a34..884fb77 100644 --- a/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php +++ b/core/modules/dblog/lib/Drupal/dblog/Tests/DbLogTest.php @@ -90,7 +90,7 @@ private function verifyRowLimit($row_limit) { $this->assertResponse(200); // Check row limit variable. - $current_limit = \Drupal::config('dblog.settings')->get('row_limit'); + $current_limit = \\Drupal::config('dblog.settings')->get('row_limit'); $this->assertTrue($current_limit == $row_limit, format_string('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit))); } 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/edit/lib/Drupal/edit/Form/EditFieldForm.php b/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php index 1477e46..6f5a30c 100644 --- a/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php +++ b/core/modules/edit/lib/Drupal/edit/Form/EditFieldForm.php @@ -76,7 +76,7 @@ protected function init(array &$form_state, EntityInterface $entity, $field_name 'bundle' => $entity->bundle(), 'form_mode' => 'default', ); - \Drupal::moduleHandler()->alter('entity_form_display', $form_display, $form_display_context); + \\Drupal::moduleHandler()->alter('entity_form_display', $form_display, $form_display_context); $form_state['form_display'] = $form_display; } diff --git a/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php b/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php index 87261de..2eb1be4 100644 --- a/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php +++ b/core/modules/edit/lib/Drupal/edit/Tests/EditLoadingTest.php @@ -171,7 +171,7 @@ function testUserWithPermission() { $this->assertIdentical('settings', $ajax_commands[0]['command'], 'The first AJAX command is a settings command.'); // Second command: insert libraries into DOM. $this->assertIdentical('insert', $ajax_commands[1]['command'], 'The second AJAX command is an append command.'); - $command = new AppendCommand('body', '' . "\n"); + $command = new AppendCommand('body', '' . "\n"); $this->assertIdentical($command->render(), $ajax_commands[1], 'The append command contains the expected data.'); // Retrieving the form for this field should result in a 200 response, 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/lib/Drupal/editor/Entity/Editor.php b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php index 8f25368..40fe41a 100644 --- a/core/modules/editor/lib/Drupal/editor/Entity/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Entity/Editor.php @@ -81,7 +81,7 @@ public function label($langcode = NULL) { public function __construct(array $values, $entity_type) { parent::__construct($values, $entity_type); - $manager = \Drupal::service('plugin.manager.editor'); + $manager = \\Drupal::service('plugin.manager.editor'); $plugin = $manager->createInstance($this->editor); // Initialize settings, merging module-provided defaults. diff --git a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php index 4635053..786768d 100644 --- a/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php +++ b/core/modules/editor/lib/Drupal/editor/Plugin/InPlaceEditor/Editor.php @@ -37,7 +37,7 @@ function isCompatible(FieldDefinitionInterface $field_definition, array $items) elseif ($field_definition->getFieldSetting('text_processing')) { $format_id = $items[0]['format']; if (isset($format_id) && $editor = editor_load($format_id)) { - $definition = \Drupal::service('plugin.manager.editor')->getDefinition($editor->editor); + $definition = \\Drupal::service('plugin.manager.editor')->getDefinition($editor->editor); if ($definition['supports_inline_editing'] === TRUE) { return TRUE; } @@ -68,10 +68,10 @@ protected function textFormatHasTransformationFilters($format_id) { * Implements \Drupal\edit\EditPluginInterface::getAttachments(). */ public function getAttachments() { - $user = \Drupal::currentUser(); + $user = \\Drupal::currentUser(); $user_format_ids = array_keys(filter_formats($user)); - $manager = \Drupal::service('plugin.manager.editor'); + $manager = \\Drupal::service('plugin.manager.editor'); $definitions = $manager->getDefinitions(); // Filter the current user's formats to those that support inline editing. diff --git a/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php b/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php index dc593a9..e2967c7 100644 --- a/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php +++ b/core/modules/editor/lib/Drupal/editor/Tests/EditorManagerTest.php @@ -114,7 +114,7 @@ function testManager() { // Case 4: a text editor available associated, but now with its JS settings // being altered via hook_editor_js_settings_alter(). - \Drupal::state()->set('editor_test_js_settings_alter_enabled', TRUE); + \\Drupal::state()->set('editor_test_js_settings_alter_enabled', TRUE); $expected['js'][0]['data']['editor']['formats']['full_html']['editorSettings']['ponyModeEnabled'] = FALSE; $this->assertIdentical($expected, $this->editorManager->getAttachments(array('filtered_html', 'full_html')), 'hook_editor_js_settings_alter() works correctly.'); } 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/email/lib/Drupal/email/Plugin/field/field_type/ConfigurableEmailItem.php b/core/modules/email/lib/Drupal/email/Plugin/field/field_type/ConfigurableEmailItem.php index b346c4b..1b4a87d 100644 --- a/core/modules/email/lib/Drupal/email/Plugin/field/field_type/ConfigurableEmailItem.php +++ b/core/modules/email/lib/Drupal/email/Plugin/field/field_type/ConfigurableEmailItem.php @@ -56,7 +56,7 @@ public static function schema(FieldInterface $field) { * {@inheritdoc} */ public function getConstraints() { - $constraint_manager = \Drupal::typedData()->getValidationConstraintManager(); + $constraint_manager = \\Drupal::typedData()->getValidationConstraintManager(); $constraints = parent::getConstraints(); $constraints[] = $constraint_manager->create('ComplexData', array( 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/lib/Drupal/entity/Entity/EntityDisplay.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityDisplay.php index 29bf629..a7fea9a 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity/EntityDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityDisplay.php @@ -36,7 +36,7 @@ class EntityDisplay extends EntityDisplayBase implements EntityDisplayInterface * {@inheritdoc} */ public function __construct(array $values, $entity_type) { - $this->pluginManager = \Drupal::service('plugin.manager.field.formatter'); + $this->pluginManager = \\Drupal::service('plugin.manager.field.formatter'); $this->displayContext = 'display'; parent::__construct($values, $entity_type); diff --git a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php index 6b01510..a801573 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php @@ -36,7 +36,7 @@ class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayIn * {@inheritdoc} */ public function __construct(array $values, $entity_type) { - $this->pluginManager = \Drupal::service('plugin.manager.field.widget'); + $this->pluginManager = \\Drupal::service('plugin.manager.field.widget'); $this->displayContext = 'form'; parent::__construct($values, $entity_type); diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php index 637489b..c402074 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php +++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityDisplayTest.php @@ -156,9 +156,9 @@ public function testFieldComponent() { // Check that providing no options results in default values being used. $display->setComponent($field_name); - $field_type_info = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type); + $field_type_info = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type); $default_formatter = $field_type_info['default_formatter']; - $formatter_settings = \Drupal::service('plugin.manager.field.formatter')->getDefinition($default_formatter); + $formatter_settings = \\Drupal::service('plugin.manager.field.formatter')->getDefinition($default_formatter); $expected = array( 'weight' => 0, 'label' => 'above', diff --git a/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php b/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php index 595ac74..79f5c85 100644 --- a/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php +++ b/core/modules/entity/lib/Drupal/entity/Tests/EntityFormDisplayTest.php @@ -78,9 +78,9 @@ public function testFieldComponent() { // Check that providing no options results in default values being used. $form_display->setComponent($field_name); - $field_type_info = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type); + $field_type_info = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type); $default_widget = $field_type_info['default_widget']; - $widget_settings = \Drupal::service('plugin.manager.field.widget')->getDefinition($default_widget); + $widget_settings = \\Drupal::service('plugin.manager.field.widget')->getDefinition($default_widget); $expected = array( 'weight' => 0, 'type' => $default_widget, diff --git a/core/modules/entity_reference/entity_reference.module b/core/modules/entity_reference/entity_reference.module index 10364d8..243af0c 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(); } @@ -220,7 +220,7 @@ function entity_reference_query_entity_reference_alter(AlterableInterface $query */ function entity_reference_create_instance($entity_type, $bundle, $field_name, $field_label, $target_entity_type, $selection_handler = 'default', $selection_handler_settings = array()) { // If a field type we know should exist isn't found, clear the field cache. - if (!\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition('entity_reference')) { + if (!\\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition('entity_reference')) { field_cache_clear(); } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php index 74a1a8a..166ea95 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/entity_reference/selection/SelectionBase.php @@ -57,7 +57,7 @@ public function __construct(FieldDefinitionInterface $field_definition, EntityIn public static function settingsForm(FieldDefinitionInterface $field_definition) { $target_type = $field_definition->getFieldSetting('target_type'); $selection_handler_settings = $field_definition->getFieldSetting('handler_settings') ?: array(); - $entity_info = \Drupal::entityManager()->getDefinition($target_type); + $entity_info = \\Drupal::entityManager()->getDefinition($target_type); $bundles = entity_get_bundles($target_type); // Merge-in default values. @@ -259,7 +259,7 @@ public function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') { $handler_settings = $this->fieldDefinition->getFieldSetting('handler_settings'); $entity_info = entity_get_info($target_type); - $query = \Drupal::entityQuery($target_type); + $query = \\Drupal::entityQuery($target_type); if (!empty($handler_settings['target_bundles'])) { $query->condition($entity_info['entity_keys']['bundle'], $handler_settings['target_bundles'], 'IN'); } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php index ee5e79a..b4fee2d 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/field_type/ConfigurableEntityReferenceItem.php @@ -67,7 +67,7 @@ public static function schema(FieldInterface $field) { ); // Create a foreign key to the target entity type base type. - $entity_manager = \Drupal::service('entity.manager'); + $entity_manager = \\Drupal::service('entity.manager'); if (is_subclass_of($entity_manager->getControllerClass($field['settings']['target_type'], 'storage'), 'Drupal\Core\Entity\DatabaseStorageController')) { $entity_info = $entity_manager->getDefinition($field['settings']['target_type']); @@ -102,7 +102,7 @@ public function preSave() { public function settingsForm(array $form, array &$form_state, $has_data) { // Select the target entity type. $entity_type_options = array(); - foreach (\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) { + foreach (\\Drupal::entityManager()->getDefinitions() as $entity_type => $entity_info) { // @todo As the database schema can currently only store numeric IDs of // referenced entities and configuration entities have string IDs, prevent // configuration entities from being referenced. @@ -131,10 +131,10 @@ public function instanceSettingsForm(array $form, array &$form_state) { $instance = $form_state['instance']; // Get all selection plugins for this entity type. - $selection_plugins = \Drupal::service('plugin.manager.entity_reference.selection')->getSelectionGroups($this->getFieldSetting('target_type')); + $selection_plugins = \\Drupal::service('plugin.manager.entity_reference.selection')->getSelectionGroups($this->getFieldSetting('target_type')); $handler_groups = array_keys($selection_plugins); - $handlers = \Drupal::service('plugin.manager.entity_reference.selection')->getDefinitions(); + $handlers = \\Drupal::service('plugin.manager.entity_reference.selection')->getDefinitions(); $handlers_options = array(); foreach ($handlers as $plugin_id => $plugin) { // We only display base plugins (e.g. 'default', 'views', ...) and not @@ -186,7 +186,7 @@ public function instanceSettingsForm(array $form, array &$form_state) { '#attributes' => array('class' => array('entity_reference-settings')), ); - $handler = \Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($instance); + $handler = \\Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($instance); $form['handler']['handler_settings'] += $handler->settingsForm($instance); return $form; diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteTagsWidget.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteTagsWidget.php index 6d46c2f..e46ccb3 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteTagsWidget.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteTagsWidget.php @@ -38,7 +38,7 @@ class AutocompleteTagsWidget extends AutocompleteWidgetBase { public function elementValidate($element, &$form_state, $form) { $value = array(); // If a value was entered into the autocomplete. - $handler = \Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($this->fieldDefinition); + $handler = \\Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($this->fieldDefinition); $bundles = entity_get_bundles($this->getFieldSetting('target_type')); $auto_create = $this->getSelectionHandlerSetting('auto_create'); diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidget.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidget.php index fb2b575..cc4966b 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidget.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidget.php @@ -69,7 +69,7 @@ public function elementValidate($element, &$form_state, $form) { else { // Try to get a match from the input string when the user didn't use the // autocomplete but filled in a value manually. - $handler = \Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($this->fieldDefinition); + $handler = \\Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($this->fieldDefinition); $value = $handler->validateAutocompleteInput($element['#value'], $element, $form_state, $form, !$auto_create); } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php index 3587046..f9841d1 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Plugin/field/widget/AutocompleteWidgetBase.php @@ -155,7 +155,7 @@ protected function getLabels(FieldInterface $items) { * @return \Drupal\Core\Entity\EntityInterface */ protected function createNewEntity($label, $uid) { - $entity_manager = \Drupal::entityManager(); + $entity_manager = \\Drupal::entityManager(); $target_type = $this->getFieldSetting('target_type'); $target_bundles = $this->getSelectionHandlerSetting('target_bundles'); diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php index 09fec90..fcc13b6 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceAutoCreateTest.php @@ -85,7 +85,7 @@ public function testAutoCreate() { $new_title = $this->randomName(); // Assert referenced node does not exist. - $base_query = \Drupal::entityQuery('node'); + $base_query = \\Drupal::entityQuery('node'); $base_query ->condition('type', $this->referenced_type) ->condition('title', $new_title); @@ -108,7 +108,7 @@ public function testAutoCreate() { $referenced_node = node_load($referenced_nid); // Assert the referenced node is associated with referencing node. - $result = \Drupal::entityQuery('node') + $result = \\Drupal::entityQuery('node') ->condition('type', $this->referencing_type) ->execute(); diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php index b97dce4..e02fb18 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceSelectionAccessTest.php @@ -34,7 +34,7 @@ function setUp() { } protected function assertReferenceable(FieldDefinitionInterface $field_definition, $tests, $handler_name) { - $handler = \Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($field_definition); + $handler = \\Drupal::service('plugin.manager.entity_reference.selection')->getSelectionHandler($field_definition); foreach ($tests as $test) { foreach ($test['arguments'] as $arguments) { @@ -249,7 +249,7 @@ public function testUserHandler() { ), ); - $user_values['anonymous']->name = \Drupal::config('user.settings')->get('anonymous'); + $user_values['anonymous']->name = \\Drupal::config('user.settings')->get('anonymous'); $users = array(); $user_labels = array(); diff --git a/core/modules/field/field.deprecated.inc b/core/modules/field/field.deprecated.inc index 8ac601e..b891b38 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,10 +48,10 @@ 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); + return \\Drupal::service('plugin.manager.entity.field.field_type')->getDefaultSettings($type); } /** @@ -65,10 +65,10 @@ 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); + 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,10 +108,10 @@ 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); + 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,10 +152,10 @@ 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); + return \\Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($type); } /** @@ -575,9 +575,9 @@ function field_attach_form(EntityInterface $entity, &$form, &$form_state, $langc $form['#bundle'] = $entity->bundle(); // Let other modules make changes to the form. - // Avoid \Drupal::moduleHandler()->invokeAll() + // 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); } @@ -671,9 +671,9 @@ function field_attach_extract_form_values(EntityInterface $entity, $form, &$form field_invoke_method('extractFormValues', _field_invoke_widget_target($form_display), $entity, $form, $form_state, $options); // Let other modules act on submitting the entity. - // Avoid \Drupal::moduleHandler()->invokeAll() + // 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..2d1d4e1 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(); } @@ -62,7 +62,7 @@ function field_info_cache_clear() { function field_behaviors_widget($op, $instance) { $info = array(); if ($component = entity_get_form_display($instance['entity_type'], $instance['bundle'], 'default')->getComponent($instance['field_name'])) { - $info = \Drupal::service('plugin.manager.field.widget')->getDefinition($component['type']); + $info = \\Drupal::service('plugin.manager.field.widget')->getDefinition($component['type']); } return isset($info[$op]) ? $info[$op] : FIELD_BEHAVIOR_DEFAULT; } 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..4df4783 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); } @@ -267,7 +267,7 @@ function _field_generate_entity_field_definition(FieldInterface $field, FieldIns */ function field_field_widget_info_alter(&$info) { // Add the Hidden widget to all field types. - $info['hidden']['field_types'] = array_keys(\Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions()); + $info['hidden']['field_types'] = array_keys(\\Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions()); } /** @@ -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..7d65889 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; @@ -118,7 +118,7 @@ function field_views_field_default_views_data(FieldInterface $field) { $data = array(); // Check the field type is available. - if (!\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field['type'])) { + if (!\\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field['type'])) { return $data; } // Check the field has instances. @@ -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/Entity/Field.php b/core/modules/field/lib/Drupal/field/Entity/Field.php index 3421461..2476f27 100644 --- a/core/modules/field/lib/Drupal/field/Entity/Field.php +++ b/core/modules/field/lib/Drupal/field/Entity/Field.php @@ -306,7 +306,7 @@ public function save() { * In case of failures at the configuration storage level. */ protected function saveNew() { - $entity_manager = \Drupal::entityManager(); + $entity_manager = \\Drupal::entityManager(); $storage_controller = $entity_manager->getStorageController($this->entityType); // Assign the ID. @@ -342,7 +342,7 @@ protected function saveNew() { } // Check that the field type is known. - $field_type = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->type); + $field_type = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->type); if (!$field_type) { throw new FieldException(format_string('Attempt to create a field of unknown type %type.', array('%type' => $this->type))); } @@ -375,8 +375,8 @@ protected function saveNew() { * In case of failures at the configuration storage level. */ protected function saveUpdated() { - $module_handler = \Drupal::moduleHandler(); - $entity_manager = \Drupal::entityManager(); + $module_handler = \\Drupal::moduleHandler(); + $entity_manager = \\Drupal::entityManager(); $storage_controller = $entity_manager->getStorageController($this->entityType); $original = $storage_controller->loadUnchanged($this->id()); @@ -416,8 +416,8 @@ protected function saveUpdated() { */ public function delete() { if (!$this->deleted) { - $instance_controller = \Drupal::entityManager()->getStorageController('field_instance'); - $state = \Drupal::state(); + $instance_controller = \\Drupal::entityManager()->getStorageController('field_instance'); + $state = \\Drupal::state(); // Delete all non-deleted instances. $instance_ids = array(); @@ -432,7 +432,7 @@ public function delete() { $instance->delete(FALSE); } - \Drupal::entityManager()->getStorageController($this->entity_type)->onFieldDelete($this); + \\Drupal::entityManager()->getStorageController($this->entity_type)->onFieldDelete($this); // Delete the configuration of this field and save the field configuration // in the key_value table so we can use it later during @@ -457,7 +457,7 @@ public function delete() { public function getSchema() { if (!isset($this->schema)) { // Get the schema from the field item class. - $definition = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->type); + $definition = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->type); $class = $definition['class']; $schema = $class::schema($this); // Fill in default values for optional entries. @@ -527,7 +527,7 @@ public function getFieldSettings() { // maintains its own static cache. However, do some CPU and memory // profiling to see if it's worth statically caching $field_type_info, or // the default field and instance settings, within $this. - $field_type_info = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->type); + $field_type_info = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->type); $settings = $this->settings + $field_type_info['settings'] + $field_type_info['instance_settings']; return $settings; @@ -538,7 +538,7 @@ public function getFieldSettings() { */ public function getFieldSetting($setting_name) { // @todo See getFieldSettings() about potentially statically caching this. - $field_type_info = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->type); + $field_type_info = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->type); // We assume here that consecutive array_key_exists() is more efficient than // calling getFieldSettings() when all we need is a single setting. @@ -672,9 +672,9 @@ public function hasData() { if ($this->getBundles()) { $storage_details = $this->getSchema(); $columns = array_keys($storage_details['columns']); - $factory = \Drupal::service('entity.query'); + $factory = \\Drupal::service('entity.query'); // Entity Query throws an exception if there is no base table. - $entity_info = \Drupal::entityManager()->getDefinition($this->entity_type); + $entity_info = \\Drupal::entityManager()->getDefinition($this->entity_type); if (!isset($entity_info['base_table'])) { return FALSE; } diff --git a/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php b/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php index eaa0c70..05ced68 100644 --- a/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldInstance.php @@ -356,7 +356,7 @@ public function save() { * In case of failures at the configuration storage level. */ protected function saveNew() { - $instance_controller = \Drupal::entityManager()->getStorageController($this->entityType); + $instance_controller = \\Drupal::entityManager()->getStorageController($this->entityType); // Ensure the field instance is unique within the bundle. if ($prior_instance = $instance_controller->load($this->id())) { @@ -389,7 +389,7 @@ protected function saveNew() { * In case of failures at the configuration storage level. */ protected function saveUpdated() { - $instance_controller = \Drupal::entityManager()->getStorageController($this->entityType); + $instance_controller = \\Drupal::entityManager()->getStorageController($this->entityType); $original = $instance_controller->loadUnchanged($this->getOriginalID()); $this->original = $original; @@ -409,7 +409,7 @@ protected function saveUpdated() { $this->prepareSave(); // Notify the entity storage controller. - \Drupal::entityManager()->getStorageController($this->entity_type)->onInstanceUpdate($this); + \\Drupal::entityManager()->getStorageController($this->entity_type)->onInstanceUpdate($this); // Save the configuration. $result = parent::save(); @@ -422,7 +422,7 @@ protected function saveUpdated() { * Prepares the instance definition for saving. */ protected function prepareSave() { - $field_type_info = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->field->type); + $field_type_info = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->field->type); // Set the default instance settings. $this->settings += $field_type_info['instance_settings']; @@ -438,7 +438,7 @@ protected function prepareSave() { */ public function delete($field_cleanup = TRUE) { if (!$this->deleted) { - $state = \Drupal::state(); + $state = \\Drupal::state(); // Delete the configuration of this instance and save the configuration // in the key_value table so we can use it later during @@ -452,7 +452,7 @@ public function delete($field_cleanup = TRUE) { parent::delete(); // Notify the entity storage controller. - \Drupal::entityManager()->getStorageController($this->entity_type)->onInstanceDelete($this); + \\Drupal::entityManager()->getStorageController($this->entity_type)->onInstanceDelete($this); // Clear the cache. field_cache_clear(); @@ -538,7 +538,7 @@ public function isFieldTranslatable() { * {@inheritdoc} */ public function uri() { - $path = \Drupal::entityManager()->getAdminPath($this->entity_type, $this->bundle); + $path = \\Drupal::entityManager()->getAdminPath($this->entity_type, $this->bundle); // Use parent URI as fallback, if path is empty. if (empty($path)) { diff --git a/core/modules/field/lib/Drupal/field/Field.php b/core/modules/field/lib/Drupal/field/Field.php index f70d6dc..6c80f01 100644 --- a/core/modules/field/lib/Drupal/field/Field.php +++ b/core/modules/field/lib/Drupal/field/Field.php @@ -19,7 +19,7 @@ class Field { * Returns a field info object. */ public static function fieldInfo() { - return \Drupal::service('field.info'); + return \\Drupal::service('field.info'); } } diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php index 6b3c137..ad63870 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigEntityReferenceItemBase.php @@ -73,7 +73,7 @@ public function getPropertyDefinitions() { * since we cannot extend it. */ public static function schema(FieldInterface $field) { - $definition = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type); + $definition = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type); $module = $definition['provider']; module_load_install($module); $callback = "{$module}_field_schema"; diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php index a878c1a..10526a9 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/FieldType/ConfigField.php @@ -55,7 +55,7 @@ public function getConstraints() { // widgets. $cardinality = $this->getFieldDefinition()->getFieldCardinality(); if ($cardinality != FIELD_CARDINALITY_UNLIMITED) { - $constraints[] = \Drupal::typedData() + $constraints[] = \\Drupal::typedData() ->getValidationConstraintManager() ->create('Count', array( 'max' => $cardinality, @@ -144,7 +144,7 @@ protected function defaultValueWidget(array &$form_state) { $entity_form_display = entity_get_form_display($entity->entityType(), $entity->bundle(), 'default'); $widget = $entity_form_display->getRenderer($this->getFieldDefinition()->getFieldName()); if (!$widget) { - $widget = \Drupal::service('plugin.manager.field.widget')->getInstance(array('field_definition' => $this->getFieldDefinition())); + $widget = \\Drupal::service('plugin.manager.field.widget')->getInstance(array('field_definition' => $this->getFieldDefinition())); } $form_state['default_value_widget'] = $widget; 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/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php index f663959..65ce33c 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Formatter/FormatterPluginManager.php @@ -74,7 +74,7 @@ public function createInstance($plugin_id, array $configuration) { // \Drupal\field\Plugin\Type\Formatter\FormatterBase::__construct(). // If the plugin provides a factory method, pass the container to it. if (is_subclass_of($plugin_class, 'Drupal\Core\Plugin\ContainerFactoryPluginInterface')) { - return $plugin_class::create(\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition); + return $plugin_class::create(\\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition); } return new $plugin_class($plugin_id, $plugin_definition, $configuration['field_definition'], $configuration['settings'], $configuration['label'], $configuration['view_mode']); diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php index e6839d3..10d6e68 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php @@ -81,7 +81,7 @@ public function form(EntityInterface $entity, $langcode, FieldInterface $items, $delta = isset($get_delta) ? $get_delta : 0; $element = array( '#title' => check_plain($this->fieldDefinition->getFieldLabel()), - '#description' => field_filter_xss(\Drupal::token()->replace($this->fieldDefinition->getFieldDescription())), + '#description' => field_filter_xss(\\Drupal::token()->replace($this->fieldDefinition->getFieldDescription())), ); $element = $this->formSingleElement($entity, $items, $delta, $langcode, $element, $form, $form_state); @@ -170,7 +170,7 @@ protected function formMultipleElements(EntityInterface $entity, FieldInterface $wrapper_id = drupal_html_id($id_prefix . '-add-more-wrapper'); $title = check_plain($this->fieldDefinition->getFieldLabel()); - $description = field_filter_xss(\Drupal::token()->replace($this->fieldDefinition->getFieldDescription())); + $description = field_filter_xss(\\Drupal::token()->replace($this->fieldDefinition->getFieldDescription())); $elements = array(); diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php index 5559e8a..81de902 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetPluginManager.php @@ -127,7 +127,7 @@ public function createInstance($plugin_id, array $configuration = array()) { // If the plugin provides a factory method, pass the container to it. if (is_subclass_of($plugin_class, 'Drupal\Core\Plugin\ContainerFactoryPluginInterface')) { - return $plugin_class::create(\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition); + return $plugin_class::create(\\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition); } return new $plugin_class($plugin_id, $plugin_definition, $configuration['field_definition'], $configuration['settings']); diff --git a/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php b/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php index e46622f..5001940 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php +++ b/core/modules/field/lib/Drupal/field/Plugin/field/field_type/LegacyConfigFieldItem.php @@ -32,7 +32,7 @@ * {@inheritdoc} */ public static function schema(FieldInterface $field) { - $definition = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type); + $definition = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field->type); $module = $definition['provider']; module_load_install($module); $callback = "{$module}_field_schema"; diff --git a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php index ea74a94..1c4656f 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php +++ b/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php @@ -302,7 +302,7 @@ protected function defineOptions() { // defineOptions runs before init/construct, so no $this->field_info $field = field_info_field($this->definition['entity_type'], $this->definition['field_name']); - $field_type = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field['type']); + $field_type = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field['type']); $column_names = array_keys($field['columns']); $default_column = ''; // Try to determine a sensible default. @@ -427,7 +427,7 @@ public function buildOptionsForm(&$form, &$form_state) { // Get the currently selected formatter. $format = $this->options['type']; - $settings = $this->options['settings'] + \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($format); + $settings = $this->options['settings'] + \\Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($format); $options = array( 'field_definition' => $field, diff --git a/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php b/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php index 0baa951..6fefd21 100644 --- a/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/BulkDeleteTest.php @@ -167,7 +167,7 @@ function testDeleteFieldInstance() { $bundle = reset($this->bundles); $field = reset($this->fields); $field_name = $field->name; - $factory = \Drupal::service('entity.query'); + $factory = \\Drupal::service('entity.query'); // There are 10 entities of this bundle. $found = $factory->get('entity_test') @@ -239,7 +239,7 @@ function testPurgeInstance() { field_purge_batch($batch_size); // There are $count deleted entities left. - $found = \Drupal::entityQuery('entity_test') + $found = \\Drupal::entityQuery('entity_test') ->condition('type', $bundle) ->condition($field->name . '.deleted', 1) ->execute(); diff --git a/core/modules/field/lib/Drupal/field/Tests/CrudTest.php b/core/modules/field/lib/Drupal/field/Tests/CrudTest.php index 7578ed2..d0acbe5 100644 --- a/core/modules/field/lib/Drupal/field/Tests/CrudTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/CrudTest.php @@ -50,7 +50,7 @@ function testCreateField() { // Read the configuration. Check against raw configuration data rather than // the loaded ConfigEntity, to be sure we check that the defaults are // applied on write. - $field_config = \Drupal::config('field.field.' . $field->id())->get(); + $field_config = \\Drupal::config('field.field.' . $field->id())->get(); // Ensure that basic properties are preserved. $this->assertEqual($field_config['name'], $field_definition['name'], 'The field name is properly saved.'); @@ -62,7 +62,7 @@ function testCreateField() { $this->assertEqual($field_config['cardinality'], 1, 'Cardinality defaults to 1.'); // Ensure that default settings are present. - $field_type = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field_definition['type']); + $field_type = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field_definition['type']); $this->assertEqual($field_config['settings'], $field_type['settings'], 'Default field settings have been written.'); // Guarantee that the name is unique. diff --git a/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php b/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php index 3bfc7d2..38d581b 100644 --- a/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/DisplayApiTest.php @@ -122,7 +122,7 @@ function testFieldViewField() { // No display settings: check that default display settings are used. $output = field_view_field($this->entity, $this->field_name); $this->content = drupal_render($output); - $settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings('field_test_default'); + $settings = \\Drupal::service('plugin.manager.field.formatter')->getDefaultSettings('field_test_default'); $setting = $settings['test_formatter_setting']; $this->assertText($this->label, 'Label was displayed.'); foreach ($this->values as $delta => $value) { @@ -194,7 +194,7 @@ function testFieldViewField() { */ function testFieldViewValue() { // No display settings: check that default display settings are used. - $settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings('field_test_default'); + $settings = \\Drupal::service('plugin.manager.field.formatter')->getDefaultSettings('field_test_default'); $setting = $settings['test_formatter_setting']; foreach ($this->values as $delta => $value) { $item = $this->entity->{$this->field_name}[$delta]->getValue(); diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldImportDeleteTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldImportDeleteTest.php index 23ae199..26ff352 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldImportDeleteTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldImportDeleteTest.php @@ -87,14 +87,14 @@ public function testImportDelete() { $this->assertIdentical($active->listAll($instance_config_name_2b), array()); // Check that the field definition is preserved in state. - $deleted_fields = \Drupal::state()->get('field.field.deleted') ?: array(); + $deleted_fields = \\Drupal::state()->get('field.field.deleted') ?: array(); $this->assertTrue(isset($deleted_fields[$field_uuid])); $this->assertTrue(isset($deleted_fields[$field_uuid_2])); // Purge field data, and check that the field definition has been completely // removed once the data is purged. field_purge_batch(10); - $deleted_fields = \Drupal::state()->get('field.field.deleted') ?: array(); + $deleted_fields = \\Drupal::state()->get('field.field.deleted') ?: array(); $this->assertTrue(empty($deleted_fields), 'Fields are deleted'); } } diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php index 9c433aa..255f4c0 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInfoTest.php @@ -24,7 +24,7 @@ function testFieldInfo() { // Test that field_test module's fields, widgets, and formatters show up. $field_test_info = field_test_field_info(); - $info = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions(); + $info = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinitions(); foreach ($field_test_info as $t_key => $field_type) { foreach ($field_type as $key => $val) { $this->assertEqual($info[$t_key][$key], $val, format_string('Field type %t_key key %key is %value', array('%t_key' => $t_key, '%key' => $key, '%value' => print_r($val, TRUE)))); @@ -123,7 +123,7 @@ function testFieldPrepare() { // Simulate a stored field definition missing a field setting (e.g. a // third-party module adding a new field setting has been enabled, and // existing fields do not know the setting yet). - \Drupal::config('field.field.' . $field->id()) + \\Drupal::config('field.field.' . $field->id()) ->set('settings', array()) ->save(); field_info_cache_clear(); @@ -132,7 +132,7 @@ function testFieldPrepare() { $field = field_info_field('entity_test', $field_definition['name']); // Check that all expected settings are in place. - $field_type = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field_definition['type']); + $field_type = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field_definition['type']); $this->assertEqual($field['settings'], $field_type['settings'], 'All expected default field settings are present.'); } @@ -157,7 +157,7 @@ function testInstancePrepare() { // Simulate a stored instance definition missing various settings (e.g. a // third-party module adding instance settings has been enabled, but // existing instances do not know the new settings). - \Drupal::config('field.instance.' . $instance->id()) + \\Drupal::config('field.instance.' . $instance->id()) ->set('settings', array()) ->save(); field_info_cache_clear(); @@ -166,7 +166,7 @@ function testInstancePrepare() { $instance = field_info_instance($instance_definition['entity_type'], $instance_definition['field_name'], $instance_definition['bundle']); // Check that all expected instance settings are in place. - $field_type = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field_definition['type']); + $field_type = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($field_definition['type']); $this->assertEqual($instance['settings'], $field_type['instance_settings'] , 'All expected instance settings are present.'); } @@ -285,7 +285,7 @@ function testFieldMap() { function testSettingsInfo() { $info = field_test_field_info(); foreach ($info as $type => $data) { - $field_type_manager = \Drupal::service('plugin.manager.entity.field.field_type'); + $field_type_manager = \\Drupal::service('plugin.manager.entity.field.field_type'); $this->assertIdentical($field_type_manager->getDefaultSettings($type), $data['settings'], format_string("field settings service returns %type's field settings", array('%type' => $type))); $this->assertIdentical($field_type_manager->getDefaultInstanceSettings($type), $data['instance_settings'], format_string("field instance settings service returns %type's field instance settings", array('%type' => $type))); } @@ -312,7 +312,7 @@ function testFieldInfoCache() { // field_test_entity_info(). Ensure the test field is still in the returned // array. field_info_cache_clear(); - \Drupal::state()->set('field_test.clear_info_cache_in_hook_entity_info', TRUE); + \\Drupal::state()->set('field_test.clear_info_cache_in_hook_entity_info', TRUE); $fields = field_info_fields(); $this->assertTrue(isset($fields[$field->uuid]), 'The test field is found in the array returned by field_info_fields() even if its cache is cleared while being rebuilt.'); } @@ -321,7 +321,7 @@ function testFieldInfoCache() { * Test that the widget definition functions work. */ function testWidgetDefinition() { - $widget_definition = \Drupal::service('plugin.manager.field.widget')->getDefinition('test_field_widget_multiple'); + $widget_definition = \\Drupal::service('plugin.manager.field.widget')->getDefinition('test_field_widget_multiple'); // Test if hook_field_widget_info_alter is beïng called. $this->assertTrue(in_array('test_field', $widget_definition['field_types']), "The 'test_field_widget_multiple' widget is enabled for the 'test_field' field type in field_test_field_widget_info_alter()."); diff --git a/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php b/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php index 8c4afcc..eca6056 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FieldInstanceCrudTest.php @@ -73,9 +73,9 @@ function testCreateFieldInstance() { // Read the configuration. Check against raw configuration data rather than // the loaded ConfigEntity, to be sure we check that the defaults are // applied on write. - $config = \Drupal::config('field.instance.' . $instance->id())->get(); + $config = \\Drupal::config('field.instance.' . $instance->id())->get(); - $field_type = \Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->field_definition['type']); + $field_type = \\Drupal::service('plugin.manager.entity.field.field_type')->getDefinition($this->field_definition['type']); // Check that default values are set. $this->assertEqual($config['required'], FALSE, 'Required defaults to false.'); @@ -177,7 +177,7 @@ function testDeleteFieldInstance() { // Make sure the field is deleted when its last instance is deleted. $another_instance->delete(); - $deleted_fields = \Drupal::state()->get('field.field.deleted'); + $deleted_fields = \\Drupal::state()->get('field.field.deleted'); $this->assertTrue(isset($deleted_fields[$another_instance['field_id']]), 'A deleted field is marked for deletion.'); $field = field_read_field($another_instance['entity_type'], $another_instance['field_name']); $this->assertFalse($field, 'The field marked to be deleted is not found anymore in the configuration.'); diff --git a/core/modules/field/lib/Drupal/field/Tests/FormTest.php b/core/modules/field/lib/Drupal/field/Tests/FormTest.php index 4919115..e6f45f8 100644 --- a/core/modules/field/lib/Drupal/field/Tests/FormTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/FormTest.php @@ -102,7 +102,7 @@ function testFieldFormSingle() { $this->drupalGet('entity_test/add'); // Create token value expected for description. - $token_description = check_plain(\Drupal::config('system.site')->get('name')) . '_description'; + $token_description = check_plain(\\Drupal::config('system.site')->get('name')) . '_description'; $this->assertText($token_description, 'Token replacement for description is displayed'); $this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed'); $this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed'); diff --git a/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php index 0830af4..c4cf5b0 100644 --- a/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php +++ b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php @@ -124,7 +124,7 @@ function testFieldAvailableLanguages() { field_test_entity_info_translatable('entity_test', TRUE); // Test hook_field_languages() invocation on a translatable field. - \Drupal::state()->set('field_test.field_available_languages_alter', TRUE); + \\Drupal::state()->set('field_test.field_available_languages_alter', TRUE); $langcodes = field_content_languages(); $available_langcodes = field_available_languages($this->entity_type, $this->field); foreach ($available_langcodes as $delta => $langcode) { @@ -315,7 +315,7 @@ function testFieldDisplayLanguage() { $this->assertTrue(!empty($entity->getTranslation($langcode)->{$this->field_name}) && $langcode != $requested_langcode, format_string('The display language for the (single) field %field_name is %language.', array('%field_name' => $field_name, '%language' => $langcode))); // Test field_language() basic behavior without language fallback. - \Drupal::state()->set('field_test.language_fallback', FALSE); + \\Drupal::state()->set('field_test.language_fallback', FALSE); $entity->getTranslation($requested_langcode)->{$this->field_name}->value = mt_rand(1, 127); drupal_static_reset('field_language'); $display_langcode = field_language($entity->getBCEntity(), $this->field_name, $requested_langcode); 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/field_ui/lib/Drupal/field_ui/FieldOverview.php b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php index a2dbb68..98e35b3 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php @@ -92,7 +92,7 @@ public function buildForm(array $form, array &$form_state, $entity_type = NULL, $field_types = $this->fieldTypeManager->getDefinitions(); // Field prefix. - $field_prefix = \Drupal::config('field_ui.settings')->get('field_prefix'); + $field_prefix = \\Drupal::config('field_ui.settings')->get('field_prefix'); $form += array( '#entity_type' => $this->entity_type, @@ -327,7 +327,7 @@ protected function validateAddNew(array $form, array &$form_state) { $field_name = $field['field_name']; // Add the field prefix. - $field_name = \Drupal::config('field_ui.settings')->get('field_prefix') . $field_name; + $field_name = \\Drupal::config('field_ui.settings')->get('field_prefix') . $field_name; form_set_value($form['fields']['_add_new_field']['field_name'], $field_name, $form_state); } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php index 18e7f17..0e18da7 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php @@ -222,8 +222,8 @@ protected function getFieldItems(EntityInterface $entity, $field_name) { $item = $entity->get($field_name); } else { - $definitions = \Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); - $item = \Drupal::typedData()->create($definitions[$field_name], $this->instance->default_value, $field_name, $entity); + $definitions = \\Drupal::entityManager()->getFieldDefinitions($entity->entityType(), $entity->bundle()); + $item = \\Drupal::typedData()->create($definitions[$field_name], $this->instance->default_value, $field_name, $entity); } return $item; } diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php index daf263e..a5530a5 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageDisplayTest.php @@ -47,7 +47,7 @@ function testFormatterUI() { $display = entity_get_display('node', $this->type, 'default'); $display_options = $display->getComponent('field_test'); $format = $display_options['type']; - $default_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($format); + $default_settings = \\Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($format); $setting_name = key($default_settings); $setting_value = $display_options['settings'][$setting_name]; @@ -61,7 +61,7 @@ function testFormatterUI() { $edit = array('fields[field_test][type]' => 'field_test_multiple', 'refresh_rows' => 'field_test'); $this->drupalPostAjaxForm(NULL, $edit, array('op' => t('Refresh'))); $format = 'field_test_multiple'; - $default_settings = \Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($format); + $default_settings = \\Drupal::service('plugin.manager.field.formatter')->getDefaultSettings($format); $setting_name = key($default_settings); $setting_value = $default_settings[$setting_name]; $this->assertFieldByName('fields[field_test][type]', $format, 'The expected formatter is selected.'); @@ -113,7 +113,7 @@ public function testWidgetUI() { $display = entity_get_form_display('node', $this->type, 'default'); $display_options = $display->getComponent('field_test'); $widget_type = $display_options['type']; - $default_settings = \Drupal::service('plugin.manager.field.widget')->getDefaultSettings($widget_type); + $default_settings = \\Drupal::service('plugin.manager.field.widget')->getDefaultSettings($widget_type); $setting_name = key($default_settings); $setting_value = $display_options['settings'][$setting_name]; @@ -127,7 +127,7 @@ public function testWidgetUI() { $edit = array('fields[field_test][type]' => 'test_field_widget_multiple', 'refresh_rows' => 'field_test'); $this->drupalPostAjaxForm(NULL, $edit, array('op' => t('Refresh'))); $widget_type = 'test_field_widget_multiple'; - $default_settings = \Drupal::service('plugin.manager.field.widget')->getDefaultSettings($widget_type); + $default_settings = \\Drupal::service('plugin.manager.field.widget')->getDefaultSettings($widget_type); $setting_name = key($default_settings); $setting_value = $default_settings[$setting_name]; $this->assertFieldByName('fields[field_test][type]', $widget_type, 'The expected widget is selected.'); @@ -181,7 +181,7 @@ function testViewModeCustom() { $node = $this->drupalCreateNode($settings); // Gather expected output values with the various formatters. - $formatters = \Drupal::service('plugin.manager.field.formatter')->getDefinitions(); + $formatters = \\Drupal::service('plugin.manager.field.formatter')->getDefinitions(); $output = array( 'field_test_default' => $formatters['field_test_default']['settings']['test_formatter_setting'] . '|' . $value, 'field_test_with_prepare_view' => $formatters['field_test_with_prepare_view']['settings']['test_formatter_setting_additional'] . '|' . $value. '|' . ($value + 1), diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php index 79b1fbe..e47146d 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php @@ -238,7 +238,7 @@ function assertFieldSettings($bundle, $field_name, $string = 'dummy test string' function testFieldPrefix() { // Change default field prefix. $field_prefix = strtolower($this->randomName(10)); - \Drupal::config('field_ui.settings')->set('field_prefix', $field_prefix)->save(); + \\Drupal::config('field_ui.settings')->set('field_prefix', $field_prefix)->save(); // Create a field input and label exceeding the new maxlength, which is 22. $field_exceed_max_length_label = $this->randomString(23); 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/lib/Drupal/file/Plugin/field/field_type/FileItem.php b/core/modules/file/lib/Drupal/file/Plugin/field/field_type/FileItem.php index 5de9a76..0369c07 100644 --- a/core/modules/file/lib/Drupal/file/Plugin/field/field_type/FileItem.php +++ b/core/modules/file/lib/Drupal/file/Plugin/field/field_type/FileItem.php @@ -321,7 +321,7 @@ public function getUploadLocation($data = array()) { $destination = trim($settings['file_directory'], '/'); // Replace tokens. - $destination = \Drupal::token()->replace($destination, $data); + $destination = \\Drupal::token()->replace($destination, $data); return $settings['uri_scheme'] . '://' . $destination; } diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php index 3366b2b..e0705e3 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldPathTest.php @@ -62,7 +62,7 @@ function testUploadPath() { // Do token replacement using the same user which uploaded the file, not // the user running the test case. $data = array('user' => $this->admin_user); - $subdirectory = \Drupal::token()->replace('[user:uid]/[user:name]', $data); + $subdirectory = \\Drupal::token()->replace('[user:uid]/[user:name]', $data); $this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->getFilename(), $node_file->getFileUri(), format_string('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->getFileUri()))); } diff --git a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php index afbeeba..754940d 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FilePrivateTest.php @@ -32,7 +32,7 @@ public static function getInfo() { public function setUp() { parent::setUp(); node_access_rebuild(); - \Drupal::state()->set('node_access_test.private', TRUE); + \\Drupal::state()->set('node_access_test.private', TRUE); } /** diff --git a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php index 924c2b9..1e4ced2 100644 --- a/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/FileTokenReplaceTest.php @@ -25,7 +25,7 @@ public static function getInfo() { * Creates a file, then tests the tokens generated from it. */ function testFileTokenReplacement() { - $token_service = \Drupal::token(); + $token_service = \\Drupal::token(); $language_interface = language(Language::TYPE_INTERFACE); // Create file field. diff --git a/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php b/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php index b9932b7..c7e568f 100644 --- a/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/RemoteFileSaveUploadTest.php @@ -27,6 +27,6 @@ public static function getInfo() { function setUp() { parent::setUp(); - \Drupal::config('system.file')->set('default_scheme', 'dummy-remote')->save(); + \\Drupal::config('system.file')->set('default_scheme', 'dummy-remote')->save(); } } diff --git a/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php b/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php index 15e007b..82f2f60 100644 --- a/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php +++ b/core/modules/file/lib/Drupal/file/Tests/SaveUploadTest.php @@ -179,7 +179,7 @@ function testHandleExtension() { * Test dangerous file handling. */ function testHandleDangerousFile() { - $config = \Drupal::config('system.file'); + $config = \\Drupal::config('system.file'); // Allow the .php extension and make sure it gets renamed to .txt for // safety. Also check to make sure its MIME type was changed. $edit = array( @@ -223,7 +223,7 @@ function testHandleDangerousFile() { */ function testHandleFileMunge() { // Ensure insecure uploads are disabled for this test. - \Drupal::config('system.file')->set('allow_insecure_uploads', 0)->save(); + \\Drupal::config('system.file')->set('allow_insecure_uploads', 0)->save(); $this->image = file_move($this->image, $this->image->getFileUri() . '.foo.' . $this->image_extension); // Reset the hook counters to get rid of the 'move' we just called. 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/filter/lib/Drupal/filter/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php index 71ca04d..14e0e17 100644 --- a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php @@ -142,7 +142,7 @@ public function id() { */ public function filters($instance_id = NULL) { if (!isset($this->filterBag)) { - $this->filterBag = new FilterBag(\Drupal::service('plugin.manager.filter'), $this->filters); + $this->filterBag = new FilterBag(\\Drupal::service('plugin.manager.filter'), $this->filters); } if (isset($instance_id)) { return $this->filterBag->get($instance_id); @@ -257,7 +257,7 @@ public function postSave(EntityStorageControllerInterface $storage_controller, $ * TRUE if this format is the fallback format, FALSE otherwise. */ public function isFallbackFormat() { - $fallback_format = \Drupal::config('filter.settings')->get('fallback_format'); + $fallback_format = \\Drupal::config('filter.settings')->get('fallback_format'); return $this->id() == $fallback_format; } diff --git a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php index 04c312a..d0ee13d 100644 --- a/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php +++ b/core/modules/filter/lib/Drupal/filter/Plugin/Filter/FilterHtml.php @@ -102,7 +102,7 @@ public function tips($long = FALSE) { $output .= '

' . t('This site allows HTML content. While learning all of HTML may feel intimidating, learning how to use a very small number of the most basic HTML "tags" is very easy. This table provides examples for each tag that is enabled on this site.') . '

'; $output .= '

' . t('For more information see W3C\'s HTML Specifications or use your favorite search engine to find other sites that explain HTML.', array('@html-specifications' => 'http://www.w3.org/TR/html/')) . '

'; $tips = array( - 'a' => array(t('Anchors are used to make links to other pages.'), '' . check_plain(\Drupal::config('system.site')->get('name')) . ''), + 'a' => array(t('Anchors are used to make links to other pages.'), '' . check_plain(\\Drupal::config('system.site')->get('name')) . ''), 'br' => array(t('By default line break tags are automatically added, so use this tag to add additional ones. Use of this tag is different because it is not used with an open/close pair like all the others. Use the extra " /" inside the tag to maintain XHTML 1.0 compatibility'), t('Text with
line break')), 'p' => array(t('By default paragraph tags are automatically added, so use this tag to add additional ones.'), '

' . t('Paragraph one.') . '

' . t('Paragraph two.') . '

'), 'strong' => array(t('Strong', array(), array('context' => 'Font weight')), '' . t('Strong', array(), array('context' => 'Font weight')) . ''), diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterAPITest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterAPITest.php index 0efcb30..3d55030 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterAPITest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterAPITest.php @@ -193,7 +193,7 @@ function testFilterFormatAPI() { */ function testTypedDataAPI() { $definition = array('type' => 'filter_format'); - $data = \Drupal::typedData()->create($definition); + $data = \\Drupal::typedData()->create($definition); $this->assertTrue($data instanceof AllowedValuesInterface, 'Typed data object implements \Drupal\Core\TypedData\AllowedValuesInterface'); diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php index bccc9f3..41d7116 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterAdminTest.php @@ -247,7 +247,7 @@ function testFilterAdmin() { // Use plain text and see if it escapes all tags, whether allowed or not. // In order to test plain text, we have to enable the hidden variable for // "show_fallback_format", which displays plain text in the format list. - \Drupal::config('filter.settings') + \\Drupal::config('filter.settings') ->set('always_show_fallback_choice', TRUE) ->save(); $edit = array(); @@ -255,7 +255,7 @@ function testFilterAdmin() { $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); $this->drupalGet('node/' . $node->id()); $this->assertText(check_plain($text), 'The "Plain text" text format escapes all HTML tags.'); - \Drupal::config('filter.settings') + \\Drupal::config('filter.settings') ->set('always_show_fallback_choice', FALSE) ->save(); diff --git a/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php index 64b9722..fc20e75 100644 --- a/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php +++ b/core/modules/filter/lib/Drupal/filter/Tests/FilterUnitTest.php @@ -431,7 +431,7 @@ function testUrlFilter() { ), // Absolute URL protocols. // The list to test is found in the beginning of _filter_url() at - // $protocols = \Drupal::config('system.filter')->get('protocols')... (approx line 1555). + // $protocols = \\Drupal::config('system.filter')->get('protocols')... (approx line 1555). ' https://example.com, ftp://ftp.example.com, 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/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php index 5101ddc..1f6e3d9 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumNodeAccessTest.php @@ -32,7 +32,7 @@ public static function getInfo() { function setUp() { parent::setUp(); node_access_rebuild(); - \Drupal::state()->set('node_access_test.private', TRUE); + \\Drupal::state()->set('node_access_test.private', TRUE); } /** diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index 26b4dc6..638034c 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -239,8 +239,8 @@ function testForum() { */ function testAddOrphanTopic() { // Must remove forum topics to test creating orphan topics. - $vid = \Drupal::config('forum.settings')->get('vocabulary'); - $tids = \Drupal::entityQuery('taxonomy_term') + $vid = \\Drupal::config('forum.settings')->get('vocabulary'); + $tids = \\Drupal::entityQuery('taxonomy_term') ->condition('vid', $vid) ->execute(); entity_delete_multiple('taxonomy_term', $tids); @@ -342,7 +342,7 @@ private function doAdminTests($user) { */ function editForumVocabulary() { // Backup forum taxonomy. - $vid = \Drupal::config('forum.settings')->get('vocabulary'); + $vid = \\Drupal::config('forum.settings')->get('vocabulary'); $original_vocabulary = entity_load('taxonomy_vocabulary', $vid); // Generate a random name and description. @@ -408,7 +408,7 @@ function createForum($type, $parent = 0) { ); // Verify forum. - $term = db_query("SELECT * FROM {taxonomy_term_data} t WHERE t.vid = :vid AND t.name = :name AND t.description = :desc", array(':vid' => \Drupal::config('forum.settings')->get('vocabulary'), ':name' => $name, ':desc' => $description))->fetchAssoc(); + $term = db_query("SELECT * FROM {taxonomy_term_data} t WHERE t.vid = :vid AND t.name = :name AND t.description = :desc", array(':vid' => \\Drupal::config('forum.settings')->get('vocabulary'), ':name' => $name, ':desc' => $description))->fetchAssoc(); $this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database'); // Verify forum hierarchy. diff --git a/core/modules/help/lib/Drupal/help/Tests/HelpTest.php b/core/modules/help/lib/Drupal/help/Tests/HelpTest.php index 2e94f5d..40bd8b3 100644 --- a/core/modules/help/lib/Drupal/help/Tests/HelpTest.php +++ b/core/modules/help/lib/Drupal/help/Tests/HelpTest.php @@ -108,7 +108,7 @@ protected function verifyHelp($response = 200) { protected function getModuleList() { $modules = array(); $module_data = system_rebuild_module_data(); - foreach (\Drupal::moduleHandler()->getImplementations('help') as $module) { + foreach (\\Drupal::moduleHandler()->getImplementations('help') as $module) { $modules[$module] = $module_data[$module]->info['name']; } return $modules; 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/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php index 4d12539..ded54c5 100644 --- a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php +++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php @@ -200,7 +200,7 @@ public function buildUrl($path, $clean_urls = NULL) { // image derivative URL nor checked for in // \Drupal\image\ImageStyleInterface::deliver()). $token_query = array(); - if (!\Drupal::config('image.settings')->get('suppress_itok_output')) { + if (!\\Drupal::config('image.settings')->get('suppress_itok_output')) { $token_query = array(IMAGE_DERIVATIVE_TOKEN => $this->getPathToken(file_stream_wrapper_uri_normalize($path))); } @@ -208,7 +208,7 @@ public function buildUrl($path, $clean_urls = NULL) { // Assume clean URLs unless the request tells us otherwise. $clean_urls = TRUE; try { - $request = \Drupal::request(); + $request = \\Drupal::request(); $clean_urls = $request->attributes->get('clean_urls'); } catch (ServiceNotFoundException $e) { @@ -253,7 +253,7 @@ public function flush($path = NULL) { } // Let other modules update as necessary on flush. - $module_handler = \Drupal::moduleHandler(); + $module_handler = \\Drupal::moduleHandler(); $module_handler->invokeAll('image_style_flush', array($this)); // Clear field caches so that formatters may be added for this style. @@ -262,9 +262,9 @@ public function flush($path = NULL) { // Clear page caches when flushing. if ($module_handler->moduleExists('block')) { - \Drupal::cache('block')->deleteAll(); + \\Drupal::cache('block')->deleteAll(); } - \Drupal::cache('page')->deleteAll(); + \\Drupal::cache('page')->deleteAll(); return $this; } @@ -281,7 +281,7 @@ public function createDerivative($original_uri, $derivative_uri) { return FALSE; } - $image = \Drupal::service('image.factory')->get($original_uri); + $image = \\Drupal::service('image.factory')->get($original_uri); if (!$image->getResource()) { return FALSE; } @@ -348,7 +348,7 @@ public function getEffect($effect) { */ public function getEffects() { if (!$this->effectsBag) { - $this->effectsBag = new ImageEffectBag(\Drupal::service('plugin.manager.image.effect'), $this->effects); + $this->effectsBag = new ImageEffectBag(\\Drupal::service('plugin.manager.image.effect'), $this->effects); } return $this->effectsBag; } diff --git a/core/modules/image/lib/Drupal/image/Plugin/field/field_type/ImageItem.php b/core/modules/image/lib/Drupal/image/Plugin/field/field_type/ImageItem.php index a6d8972..c55dd6e 100644 --- a/core/modules/image/lib/Drupal/image/Plugin/field/field_type/ImageItem.php +++ b/core/modules/image/lib/Drupal/image/Plugin/field/field_type/ImageItem.php @@ -292,7 +292,7 @@ public function preSave() { // Determine the dimensions if necessary. if (empty($width) || empty($height)) { - $image = \Drupal::service('image.factory')->get($this->entity->getFileUri()); + $image = \\Drupal::service('image.factory')->get($this->entity->getFileUri()); if ($image->getExtension()) { $this->width = $image->getWidth(); $this->height =$image->getHeight(); diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php index 880ee6f..aa1e817 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageStylesPathAndUrlTest.php @@ -109,7 +109,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = // Make the default scheme neither "public" nor "private" to verify the // functions work for other than the default scheme. - \Drupal::config('system.file')->set('default_scheme', 'temporary')->save(); + \\Drupal::config('system.file')->set('default_scheme', 'temporary')->save(); // Create the directories for the styles. $directory = $scheme . '://styles/' . $this->style->id(); @@ -122,7 +122,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = $original_uri = file_unmanaged_copy($file->uri, $scheme . '://', FILE_EXISTS_RENAME); // Let the image_module_test module know about this file, so it can claim // ownership in hook_file_download(). - \Drupal::state()->set('image.test_file_download', $original_uri); + \\Drupal::state()->set('image.test_file_download', $original_uri); $this->assertNotIdentical(FALSE, $original_uri, 'Created the generated image file.'); // Get the URL of a file that has not been generated and try to create it. @@ -168,7 +168,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = // Make sure that access is denied for existing style files if we do not // have access. - \Drupal::state()->delete('image.test_file_download'); + \\Drupal::state()->delete('image.test_file_download'); $this->drupalGet($generate_url); $this->assertResponse(403, 'Confirmed that access is denied for the private image style.'); @@ -200,7 +200,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = // Allow insecure image derivatives to be created for the remainder of this // test. - \Drupal::config('image.settings')->set('allow_insecure_derivatives', TRUE)->save(); + \\Drupal::config('image.settings')->set('allow_insecure_derivatives', TRUE)->save(); // Create another working copy of the file. $files = $this->drupalGetTestFiles('image'); @@ -208,12 +208,12 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash = $original_uri = file_unmanaged_copy($file->uri, $scheme . '://', FILE_EXISTS_RENAME); // Let the image_module_test module know about this file, so it can claim // ownership in hook_file_download(). - \Drupal::state()->set('image.test_file_download', $original_uri); + \\Drupal::state()->set('image.test_file_download', $original_uri); // Suppress the security token in the URL, then get the URL of a file that // has not been created and try to create it. Check that the security token // is not present in the URL but that the image is still accessible. - \Drupal::config('image.settings')->set('suppress_itok_output', TRUE)->save(); + \\Drupal::config('image.settings')->set('suppress_itok_output', TRUE)->save(); $generated_uri = $this->style->buildUri($original_uri); $this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.'); $generate_url = $this->style->buildUrl($original_uri, $clean_url); 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/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php index f17e159..4bc3e41 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php @@ -43,8 +43,8 @@ function setUp() { */ function testInfoAlterations() { // Enable language type/negotiation info alterations. - \Drupal::state()->set('language_test.language_types', TRUE); - \Drupal::state()->set('language_test.language_negotiation_info', TRUE); + \\Drupal::state()->set('language_test.language_types', TRUE); + \\Drupal::state()->set('language_test.language_negotiation_info', TRUE); $this->languageNegotiationUpdate(); // Check that fixed language types are properly configured without the need @@ -53,7 +53,7 @@ function testInfoAlterations() { // Make the content language type configurable by updating the language // negotiation settings with the proper flag enabled. - \Drupal::state()->set('language_test.content_language_type', TRUE); + \\Drupal::state()->set('language_test.content_language_type', TRUE); $this->languageNegotiationUpdate(); $type = Language::TYPE_CONTENT; $language_types = language_types_get_configurable(); @@ -75,7 +75,7 @@ function testInfoAlterations() { // Remove the interface language negotiation method by updating the language // negotiation settings with the proper flag enabled. - \Drupal::state()->set('language_test.language_negotiation_info_alter', TRUE); + \\Drupal::state()->set('language_test.language_negotiation_info_alter', TRUE); $this->languageNegotiationUpdate(); $negotiation = variable_get("language_negotiation_$type", array()); $this->assertFalse(isset($negotiation[$interface_method_id]), 'Interface language negotiation method removed from the stored settings.'); @@ -95,7 +95,7 @@ function testInfoAlterations() { // Check language negotiation results. $this->drupalGet(''); - $last = \Drupal::state()->get('language_test.language_negotiation_last'); + $last = \\Drupal::state()->get('language_test.language_negotiation_last'); foreach (language_types_get_all() as $type) { $langcode = $last[$type]; $value = $type == Language::TYPE_CONTENT || strpos($type, 'test') !== FALSE ? 'it' : 'en'; diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php index e87a550..b5a0dc3 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php @@ -159,7 +159,7 @@ function testUILanguageNegotiation() { $this->runTest($test); // An invalid language is selected. - \Drupal::config('language.negotiation')->set('selected_langcode', NULL)->save(); + \\Drupal::config('language.negotiation')->set('selected_langcode', NULL)->save(); $test = array( 'language_negotiation' => array(LANGUAGE_NEGOTIATION_SELECTED), 'path' => 'admin/config', @@ -171,7 +171,7 @@ function testUILanguageNegotiation() { $this->runTest($test); // No selected language is available. - \Drupal::config('language.negotiation')->set('selected_langcode', $langcode_unknown)->save(); + \\Drupal::config('language.negotiation')->set('selected_langcode', $langcode_unknown)->save(); $test = array( 'language_negotiation' => array(LANGUAGE_NEGOTIATION_SELECTED), 'path' => 'admin/config', @@ -367,12 +367,12 @@ protected function runTest($test) { language_negotiation_set(Language::TYPE_INTERFACE, $method_weights); } if (!empty($test['language_negotiation_url_part'])) { - \Drupal::config('language.negotiation') + \\Drupal::config('language.negotiation') ->set('url.source', $test['language_negotiation_url_part']) ->save(); } if (!empty($test['language_test_domain'])) { - \Drupal::state()->set('language_test.domain', $test['language_test_domain']); + \\Drupal::state()->set('language_test.domain', $test['language_test_domain']); } $this->container->get('language_manager')->reset(); $this->drupalGet($test['path'], array(), $test['http_header']); diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php index 07ee9a9..3caa28c 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php @@ -114,7 +114,7 @@ function testDomainNameNegotiationPort() { $this->rebuildContainer(); // Enable domain configuration. - \Drupal::config('language.negotiation') + \\Drupal::config('language.negotiation') ->set('url.source', LANGUAGE_NEGOTIATION_URL_DOMAIN) ->save(); 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/language/tests/language_test/lib/Drupal/language_test/LanguageTestManager.php b/core/modules/language/tests/language_test/lib/Drupal/language_test/LanguageTestManager.php index 991755e..451804d 100644 --- a/core/modules/language/tests/language_test/lib/Drupal/language_test/LanguageTestManager.php +++ b/core/modules/language/tests/language_test/lib/Drupal/language_test/LanguageTestManager.php @@ -19,7 +19,7 @@ class LanguageTestManager extends LanguageManager { * Overrides \Drupal\Core\Language\LanguageManager::init(). */ public function init() { - if ($test_domain = \Drupal::state()->get('language_test.domain')) { + if ($test_domain = \\Drupal::state()->get('language_test.domain')) { $_SERVER['HTTP_HOST'] = $test_domain; } return parent::init(); diff --git a/core/modules/link/lib/Drupal/link/Plugin/field/formatter/LinkFormatter.php b/core/modules/link/lib/Drupal/link/Plugin/field/formatter/LinkFormatter.php index 29e7eb9..5e2e540 100644 --- a/core/modules/link/lib/Drupal/link/Plugin/field/formatter/LinkFormatter.php +++ b/core/modules/link/lib/Drupal/link/Plugin/field/formatter/LinkFormatter.php @@ -129,7 +129,7 @@ public function viewElements(EntityInterface $entity, $langcode, FieldInterface if (empty($settings['url_only']) && !empty($item->title)) { // Unsanitizied token replacement here because $options['html'] is FALSE // by default in l(). - $link_title = \Drupal::token()->replace($item->title, array($entity->entityType() => $entity), array('sanitize' => FALSE, 'clear' => TRUE)); + $link_title = \\Drupal::token()->replace($item->title, array($entity->entityType() => $entity), array('sanitize' => FALSE, 'clear' => TRUE)); } // Trim the link text to the desired length. diff --git a/core/modules/link/lib/Drupal/link/Plugin/field/formatter/LinkSeparateFormatter.php b/core/modules/link/lib/Drupal/link/Plugin/field/formatter/LinkSeparateFormatter.php index f249bbe..6821185 100644 --- a/core/modules/link/lib/Drupal/link/Plugin/field/formatter/LinkSeparateFormatter.php +++ b/core/modules/link/lib/Drupal/link/Plugin/field/formatter/LinkSeparateFormatter.php @@ -50,7 +50,7 @@ public function viewElements(EntityInterface $entity, $langcode, FieldInterface if (empty($settings['url_only']) && !empty($item->title)) { // Unsanitized token replacement here because $options['html'] is FALSE // by default in l(). - $link_title = \Drupal::token()->replace($item->title, array($entity->entityType() => $entity), array('sanitize' => FALSE, 'clear' => TRUE)); + $link_title = \\Drupal::token()->replace($item->title, array($entity->entityType() => $entity), array('sanitize' => FALSE, 'clear' => TRUE)); } // The link_separate formatter has two titles; the link text (as in the diff --git a/core/modules/locale/lib/Drupal/locale/Form/LocaleSettingsForm.php b/core/modules/locale/lib/Drupal/locale/Form/LocaleSettingsForm.php index 826ba38..dac24b3 100644 --- a/core/modules/locale/lib/Drupal/locale/Form/LocaleSettingsForm.php +++ b/core/modules/locale/lib/Drupal/locale/Form/LocaleSettingsForm.php @@ -44,7 +44,7 @@ public function buildForm(array $form, array &$form_state) { '#default_value' => $config->get('translation.check_disabled_modules'), ); - if ($directory =\Drupal::config('locale.settings')->get('translation.path')) { + if ($directory =\\Drupal::config('locale.settings')->get('translation.path')) { $description = t('Translation files are stored locally in the %path directory. You can change this directory on the File system configuration page.', array('%path' => $directory, '@url' => url('admin/config/media/file-system'))); } else { diff --git a/core/modules/locale/lib/Drupal/locale/Locale.php b/core/modules/locale/lib/Drupal/locale/Locale.php index f4afaed..539610c 100644 --- a/core/modules/locale/lib/Drupal/locale/Locale.php +++ b/core/modules/locale/lib/Drupal/locale/Locale.php @@ -23,6 +23,6 @@ class Locale { * @return \Drupal\locale\LocaleConfigManager */ public static function config() { - return \Drupal::service('locale.config.typed'); + return \\Drupal::service('locale.config.typed'); } } diff --git a/core/modules/locale/lib/Drupal/locale/LocaleLookup.php b/core/modules/locale/lib/Drupal/locale/LocaleLookup.php index 8603f67..28a84ac 100644 --- a/core/modules/locale/lib/Drupal/locale/LocaleLookup.php +++ b/core/modules/locale/lib/Drupal/locale/LocaleLookup.php @@ -97,7 +97,7 @@ protected function resolveCacheMiss($offset) { $this->stringStorage->createString(array( 'source' => $offset, 'context' => $this->context, - 'version' => \Drupal::VERSION + 'version' => \\Drupal::VERSION ))->addLocation('path', request_uri())->save(); $value = TRUE; } @@ -106,7 +106,7 @@ protected function resolveCacheMiss($offset) { // the exact list of strings used on a page. From a performance // perspective that is a really bad idea, so we have no user // interface for this. Be careful when turning this option off! - if (\Drupal::config('locale.settings')->get('cache_strings')) { + if (\\Drupal::config('locale.settings')->get('cache_strings')) { $this->persist($offset); } return $value;