diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 9ee30d7..a45adaf 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -907,7 +907,7 @@ function drupal_get_filename($type, $name, $filename = NULL) { } } 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]; } diff --git a/core/includes/common.inc b/core/includes/common.inc index 3adfc02..04b2d81 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -3120,7 +3120,7 @@ function drupal_pre_render_styles($elements) { function drupal_build_css_cache($css) { $data = ''; $uri = ''; - $map = \Drupal::state()->get('drupal_css_cache_files') ?: array(); + $map = Drupal::state()->get('drupal_css_cache_files') ?: array(); // Create a new array so that only the file names are used to create the hash. // This prevents new aggregates from being created unnecessarily. $css_data = array(); @@ -3188,7 +3188,7 @@ function drupal_build_css_cache($css) { } // Save the updated map. $map[$key] = $uri; - \Drupal::state()->set('drupal_css_cache_files', $map); + Drupal::state()->set('drupal_css_cache_files', $map); } return $uri; } @@ -3353,7 +3353,7 @@ function _drupal_load_stylesheet($matches) { * 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')); } @@ -4714,7 +4714,7 @@ function drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgro function drupal_build_js_cache($files) { $contents = ''; $uri = ''; - $map = \Drupal::state()->get('system.js_cache_files') ?: array(); + $map = Drupal::state()->get('system.js_cache_files') ?: array(); // Create a new array so that only the file names are used to create the hash. // This prevents new aggregates from being created unnecessarily. $js_data = array(); @@ -4759,7 +4759,7 @@ function drupal_build_js_cache($files) { } } $map[$key] = $uri; - \Drupal::state()->set('system.js_cache_files', $map); + Drupal::state()->set('system.js_cache_files', $map); } return $uri; } @@ -4768,8 +4768,8 @@ function drupal_build_js_cache($files) { * 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')); } @@ -4816,9 +4816,9 @@ function drupal_get_hash_salt() { * The private key. */ function drupal_get_private_key() { - if (!($key = \Drupal::state()->get('system.private_key'))) { + if (!($key = Drupal::state()->get('system.private_key'))) { $key = drupal_hash_base64(drupal_random_bytes(55)); - \Drupal::state()->set('system.private_key', $key); + Drupal::state()->set('system.private_key', $key); } return $key; } @@ -5040,7 +5040,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. diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index c5e5630..57d03eb 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -926,7 +926,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; } @@ -1652,9 +1652,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. diff --git a/core/includes/menu.inc b/core/includes/menu.inc index 2dceb19..68d434c 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -327,7 +327,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 @@ -461,7 +461,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); @@ -1270,7 +1270,7 @@ 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 @@ -2629,7 +2629,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(); @@ -2909,7 +2909,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); } /** @@ -3183,8 +3183,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); @@ -3270,7 +3270,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; } diff --git a/core/includes/module.inc b/core/includes/module.inc index 2509a82..6b0f23c 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -47,7 +47,7 @@ function system_list($type) { // 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. @@ -122,7 +122,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'); } /** diff --git a/core/includes/update.inc b/core/includes/update.inc index b8399ee..a73ec63 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -170,7 +170,7 @@ function update_prepare_d8_bootstrap() { if ($has_required_schema) { if (!db_table_exists('key_value')) { $specs = array( - 'description' => 'Generic key-value storage table. See \Drupal::state() for an example.', + 'description' => 'Generic key-value storage table. See the state system for an example.', 'fields' => array( 'collection' => array( 'description' => 'A named collection of key and value pairs.', @@ -468,8 +468,8 @@ 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::state()->set('locale.translation.plurals', $plurals); + Drupal::state()->set('locale.translation.javascript', $javascript); config('language.negotiation') ->set('url.prefixes', $prefixes) ->set('url.domains', $domains) @@ -1483,7 +1483,7 @@ function update_config_manifest_add($config_prefix, array $ids) { * 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 @@ -1498,7 +1498,7 @@ function update_config_manifest_add($config_prefix, array $ids) { 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); } } diff --git a/core/includes/utility.inc b/core/includes/utility.inc index a2d48f0..f651fd6 100644 --- a/core/includes/utility.inc +++ b/core/includes/utility.inc @@ -49,7 +49,7 @@ function drupal_var_export($var, $prefix = '') { } elseif (is_object($var) && get_class($var) === 'stdClass') { // var_export() will export stdClass objects using an undefined - // magic method __set_\Drupal::state() leaving the export broken. This + // magic method __set_state() leaving the export broken. This // workaround avoids this by casting the object as an array for // export and casting it back to an object when evaluated. $output = '(object) ' . drupal_var_export((array) $var, $prefix); diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index 44547d4..bc6673c 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -29,7 +29,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 e79059f..25635f0 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -1279,7 +1279,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())); } /** @@ -2006,7 +2006,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), ), ); } diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module index 1986cea..371bfb0 100644 --- a/core/modules/config/tests/config_test/config_test.module +++ b/core/modules/config/tests/config_test/config_test.module @@ -152,7 +152,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'); } } diff --git a/core/modules/editor/tests/modules/editor_test.module b/core/modules/editor/tests/modules/editor_test.module index fc2d748..cdaf52e 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/field/field.attach.inc b/core/modules/field/field.attach.inc index bac5829..580084f 100644 --- a/core/modules/field/field.attach.inc +++ b/core/modules/field/field.attach.inc @@ -797,7 +797,7 @@ function _field_invoke_widget_target() { * @endcode * * Additionally, some processing data is placed in $form_state, and can be - * accessed by field_form_get_\Drupal::state() and field_form_set_\Drupal::state(). + * accessed by field_form_get_Drupal::state() and field_form_set_Drupal::state(). * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity for which to load form elements, used to initialize @@ -817,8 +817,8 @@ function _field_invoke_widget_target() { * An associative array of additional options. See field_invoke_method() for * details. * - * @see field_form_get_\Drupal::state() - * @see field_form_set_\Drupal::state() + * @see field_form_get_Drupal::state() + * @see field_form_set_Drupal::state() */ function field_attach_form(EntityInterface $entity, &$form, &$form_state, $langcode = NULL, array $options = array()) { // Set #parents to 'top-level' by default. diff --git a/core/modules/field/field.form.inc b/core/modules/field/field.form.inc index d184a0d..4bccf60 100644 --- a/core/modules/field/field.form.inc +++ b/core/modules/field/field.form.inc @@ -193,7 +193,7 @@ function field_add_more_js($form, $form_state) { * - errors: The array of field validation errors reported on the field. This * entry is populated at field_attach_form_validate() time. * - * @see field_form_set_\Drupal::state() + * @see field_form_set_Drupal::state() */ function field_form_get_state($parents, $field_name, $langcode, &$form_state) { $form_state_parents = _field_form_state_parents($parents, $field_name, $langcode); @@ -212,10 +212,10 @@ function field_form_get_state($parents, $field_name, $langcode, &$form_state) { * @param $form_state * The form state. * @param $field_state - * The array of data to store. See field_form_get_\Drupal::state() for the structure + * The array of data to store. See field_form_get_Drupal::state() for the structure * and content of the array. * - * @see field_form_get_\Drupal::state() + * @see field_form_get_Drupal::state() */ function field_form_set_state($parents, $field_name, $langcode, &$form_state, $field_state) { $form_state_parents = _field_form_state_parents($parents, $field_name, $langcode); diff --git a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php index e60cb13..c0ffc95 100644 --- a/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetInterface.php @@ -84,8 +84,8 @@ public function settingsForm(array $form, array &$form_state); * widgets can simply overlook this property. This identifies the * location where the field values are placed within * $form_state['values'], and is used to access processing information - * for the field through the field_form_get_\Drupal::state() and - * field_form_set_\Drupal::state() functions. + * for the field through the field_form_get_state() and + * field_form_set_state() functions. * - #columns: A list of field storage columns of the field. * - #title: The sanitized element label for the field instance, ready for * output. 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 e9a7a91..0c823a4 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(); } } @@ -56,7 +56,7 @@ function field_test_entity_bundle_info_alter(&$bundles) { $entity_info = entity_get_info(); foreach ($bundles as $entity_type => $info) { if ($entity_info[$entity_type]['module'] == 'field_test') { - $bundles[$entity_type] = \Drupal::state()->get('field_test_bundles') ?: array('test_bundle' => array('label' => 'Test Bundle')); + $bundles[$entity_type] = Drupal::state()->get('field_test_bundles') ?: array('test_bundle' => array('label' => 'Test Bundle')); if ($entity_type == 'test_entity_bundle') { $bundles[$entity_type] += array('test_entity_2' => array('label' => 'Test entity 2')); } @@ -90,9 +90,9 @@ function field_test_entity_info_translatable($entity_type = NULL, $translatable * name will be used. */ function field_test_create_bundle($bundle, $text = NULL) { - $bundles = \Drupal::state()->get('field_test.bundles') ?: array('test_bundle' => array('label' => 'Test Bundle')); + $bundles = Drupal::state()->get('field_test.bundles') ?: array('test_bundle' => array('label' => 'Test Bundle')); $bundles += array($bundle => array('label' => $text ? $text : $bundle)); - \Drupal::state()->set('field_test.bundles', $bundles); + Drupal::state()->set('field_test.bundles', $bundles); $info = entity_get_info(); foreach ($info as $type => $type_info) { @@ -111,10 +111,10 @@ function field_test_create_bundle($bundle, $text = NULL) { * The new machine-readable name of the bundle. */ function field_test_rename_bundle($bundle_old, $bundle_new) { - $bundles = \Drupal::state()->get('field_test.bundles') ?: array('test_bundle' => array('label' => 'Test Bundle')); + $bundles = Drupal::state()->get('field_test.bundles') ?: array('test_bundle' => array('label' => 'Test Bundle')); $bundles[$bundle_new] = $bundles[$bundle_old]; unset($bundles[$bundle_old]); - \Drupal::state()->set('field_test.bundles', $bundles); + Drupal::state()->set('field_test.bundles', $bundles); $info = entity_get_info(); foreach ($info as $type => $type_info) { @@ -131,9 +131,9 @@ function field_test_rename_bundle($bundle_old, $bundle_new) { * The machine-readable name of the bundle to delete. */ function field_test_delete_bundle($bundle) { - $bundles = \Drupal::state()->get('field_test.bundles') ?: array('test_bundle' => array('label' => 'Test Bundle')); + $bundles = Drupal::state()->get('field_test.bundles') ?: array('test_bundle' => array('label' => 'Test Bundle')); unset($bundles[$bundle]); - \Drupal::state()->set('field_test.bundles', $bundles); + Drupal::state()->set('field_test.bundles', $bundles); $info = entity_get_info(); foreach ($info as $type => $type_info) { 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 c37d00a..352a29d 100644 --- a/core/modules/field/tests/modules/field_test/field_test.module +++ b/core/modules/field/tests/modules/field_test/field_test.module @@ -106,7 +106,7 @@ function field_test_field_test_op_multiple($entity_type, $entities, $field, $ins * 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. @@ -119,7 +119,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/tests/modules/field_test/field_test.storage.inc b/core/modules/field/tests/modules/field_test/field_test.storage.inc index 5af0372..31073ff 100644 --- a/core/modules/field/tests/modules/field_test/field_test.storage.inc +++ b/core/modules/field/tests/modules/field_test/field_test.storage.inc @@ -71,10 +71,10 @@ function field_test_field_storage_details_alter(&$details, $field) { */ function _field_test_storage_data($data = NULL) { if (!isset($data)) { - return \Drupal::state()->get('field_test.storage_data'); + return Drupal::state()->get('field_test.storage_data'); } else { - \Drupal::state()->set('field_test.storage_data', $data); + Drupal::state()->set('field_test.storage_data', $data); } } diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index e68120d..2204846 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -327,7 +327,7 @@ function field_ui_element_info() { function field_ui_field_attach_create_bundle($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); } /** diff --git a/core/modules/file/tests/file_test/file_test.module b/core/modules/file/tests/file_test/file_test.module index c4453e4..bb1b50c 100644 --- a/core/modules/file/tests/file_test/file_test.module +++ b/core/modules/file/tests/file_test/file_test.module @@ -158,14 +158,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); } /** @@ -183,7 +183,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]; } @@ -196,7 +196,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(); } /** @@ -212,9 +212,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); } /** @@ -230,7 +230,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]; } @@ -246,9 +246,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); } /** @@ -320,7 +320,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/image/image.module b/core/modules/image/image.module index 453192c..80b77ed 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -276,7 +276,7 @@ function image_form_system_file_system_settings_alter(&$form, &$form_state) { */ function image_system_file_system_settings_submit($form, &$form_state) { if ($form['file_public_path']['#default_value'] !== $form_state['values']['file_public_path']) { - \Drupal::state()->set('menu_rebuild_needed', TRUE); + Drupal::state()->set('menu_rebuild_needed', TRUE); } } diff --git a/core/modules/image/tests/image_module_test.module b/core/modules/image/tests/image_module_test.module index b60aed1..7cc6cdd 100644 --- a/core/modules/image/tests/image_module_test.module +++ b/core/modules/image/tests/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/tests/language_test/language_test.module b/core/modules/language/tests/language_test/language_test.module index c28d83e..e191c41 100644 --- a/core/modules/language/tests/language_test/language_test.module +++ b/core/modules/language/tests/language_test/language_test.module @@ -22,7 +22,7 @@ function language_test_init() { * 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'), @@ -39,7 +39,7 @@ 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')) { unset($language_types[LANGUAGE_TYPE_CONTENT]['fixed']); } } @@ -48,7 +48,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', @@ -75,7 +75,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]); } } @@ -88,7 +88,7 @@ function language_test_store_language_negotiation() { foreach (language_types_get_all() as $type) { $last[$type] = language($type)->langcode; } - \Drupal::state()->set('language_test.language_negotiation_last', $last); + Drupal::state()->set('language_test.language_negotiation_last', $last); } /** diff --git a/core/modules/locale/locale.compare.inc b/core/modules/locale/locale.compare.inc index dd951b5..4176c99 100644 --- a/core/modules/locale/locale.compare.inc +++ b/core/modules/locale/locale.compare.inc @@ -19,7 +19,7 @@ */ function locale_translation_flush_projects() { // Followup issue: http://drupal.org/node/1842362 - // Replace {locale_project} table by \Drupal::state() variable(s). + // Replace {locale_project} table by Drupal::state() variable(s). db_truncate('locale_project')->execute(); } diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index b6eb5af..d230570 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -26,7 +26,7 @@ function locale_uninstall() { $locale_js_directory = 'public://' . $config->get('javascript.directory'); if (is_dir($locale_js_directory)) { - $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array(); + $locale_javascripts = Drupal::state()->get('locale.translation.javascript') ?: array(); foreach ($locale_javascripts as $langcode => $file_suffix) { if (!empty($file_suffix)) { file_unmanaged_delete($locale_js_directory . '/' . $langcode . '_' . $file_suffix . '.js'); @@ -39,9 +39,9 @@ function locale_uninstall() { } // Clear variables. - \Drupal::state()->delete('system.javascript_parsed'); - \Drupal::state()->delete('locale.translation.plurals'); - \Drupal::state()->delete('locale.translation.javascript'); + Drupal::state()->delete('system.javascript_parsed'); + Drupal::state()->delete('locale.translation.plurals'); + Drupal::state()->delete('locale.translation.javascript'); // Remove all node type language variables. Node module might have been // enabled, but may be disabled, so use a wildcard delete. @@ -295,7 +295,7 @@ function locale_requirements($phase) { if ($languages) { // Determine the status of the translation updates per lanuage. - $status = \Drupal::state()->get('locale.translation_status'); + $status = Drupal::state()->get('locale.translation_status'); if ($status) { foreach ($status as $project_id => $project) { foreach ($project as $langcode => $project_info) { diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index b845a6b..acbac82 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -445,7 +445,7 @@ function locale_get_plural($count, $langcode = NULL) { if (!isset($plural_indexes[$langcode][$count])) { // Retrieve and statically cache the plural formulas for all languages. if (empty($plural_formulas)) { - $plural_formulas = \Drupal::state()->get('locale.translation.plurals') ?: array(); + $plural_formulas = Drupal::state()->get('locale.translation.plurals') ?: array(); } // If there is a plural formula for the language, evaluate it for the given // $count and statically cache the result for the combination of language @@ -583,7 +583,7 @@ function locale_js_alter(&$javascript) { $language_interface = language(LANGUAGE_TYPE_INTERFACE); $dir = 'public://' . config('local.settings')->get('javascript.directory'); - $parsed = \Drupal::state()->get('system.javascript_parsed') ?: array(); + $parsed = Drupal::state()->get('system.javascript_parsed') ?: array(); $files = $new_files = FALSE; foreach ($javascript as $item) { @@ -616,16 +616,16 @@ function locale_js_alter(&$javascript) { unset($parsed['refresh:' . $language_interface->langcode]); } // Store any changes after refresh was attempted. - \Drupal::state()->set('system.javascript_parsed', $parsed); + Drupal::state()->set('system.javascript_parsed', $parsed); } // If no refresh was attempted, but we have new source files, we need // to store them too. This occurs if current page is in English. elseif ($new_files) { - \Drupal::state()->set('system.javascript_parsed', $parsed); + Drupal::state()->set('system.javascript_parsed', $parsed); } // Add the translation JavaScript file to the page. - $locale_javascripts = \Drupal::state()->get('translation.javascript') ?: array(); + $locale_javascripts = Drupal::state()->get('translation.javascript') ?: array(); if ($files && !empty($locale_javascripts[$language_interface->langcode])) { // Add the translation JavaScript file to the page. $file = $dir . '/' . $language_interface->langcode . '_' . $locale_javascripts[$language_interface->langcode] . '.js'; @@ -938,7 +938,7 @@ function locale_translation_status_save($data) { // Followup issue: http://drupal.org/node/1842362 // Split status storage per module/language and expire individually. This will // improve performance for large sites. - $status = \Drupal::state()->get('locale.translation_status'); + $status = Drupal::state()->get('locale.translation_status'); $status = empty($status) ? array() : $status; // Merge the new data into the existing structured status array. @@ -948,8 +948,8 @@ function locale_translation_status_save($data) { } } - \Drupal::state()->set('locale.translation_status', $status); - \Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); + Drupal::state()->set('locale.translation_status', $status); + Drupal::state()->set('locale.translation_last_checked', REQUEST_TIME); } /** @@ -959,7 +959,7 @@ function locale_translation_status_save($data) { * Language code(s) to be deleted from the cache. */ function locale_translation_status_delete_languages($langcodes) { - if ($status = \Drupal::state()->get('locale.translation_status')) { + if ($status = Drupal::state()->get('locale.translation_status')) { foreach ($status as $project => $languages) { foreach ($languages as $langcode => $source) { if (in_array($langcode, $langcodes)) { @@ -967,7 +967,7 @@ function locale_translation_status_delete_languages($langcodes) { } } } - \Drupal::state()->set('locale.translation_status', $status); + Drupal::state()->set('locale.translation_status', $status); } } @@ -978,22 +978,22 @@ function locale_translation_status_delete_languages($langcodes) { * Project name(s) to be deleted from the cache. */ function locale_translation_status_delete_projects($projects) { - $status = \Drupal::state()->get('locale.translation_status'); + $status = Drupal::state()->get('locale.translation_status'); foreach ($status as $project => $languages) { if (in_array($project, $projects)) { unset($status[$project]); } } - \Drupal::state()->set('locale.translation_status', $status); + Drupal::state()->set('locale.translation_status', $status); } /** * Clear the translation status cache. */ function locale_translation_clear_status() { - \Drupal::state()->delete('locale.translation_status'); - \Drupal::state()->delete('locale.translation_last_checked'); + Drupal::state()->delete('locale.translation_status'); + Drupal::state()->delete('locale.translation_last_checked'); } /** @@ -1173,7 +1173,7 @@ function _locale_parse_js_file($filepath) { * New content of the 'system.javascript_parsed' variable. */ function _locale_invalidate_js($langcode = NULL) { - $parsed = \Drupal::state()->get('system.javascript_parsed') ?: array(); + $parsed = Drupal::state()->get('system.javascript_parsed') ?: array(); if (empty($langcode)) { // Invalidate all languages. @@ -1187,7 +1187,7 @@ function _locale_invalidate_js($langcode = NULL) { $parsed['refresh:' . $langcode] = 'waiting'; } - \Drupal::state()->set('system.javascript_parsed', $parsed); + Drupal::state()->set('system.javascript_parsed', $parsed); return $parsed; } @@ -1226,7 +1226,7 @@ function _locale_rebuild_js($langcode = NULL) { if (!empty($translations)) { $data = "Drupal.locale = { "; - $locale_plurals = \Drupal::state()->get('locale.translation.plurals') ?: array(); + $locale_plurals = Drupal::state()->get('locale.translation.plurals') ?: array(); if (!empty($locale_plurals[$language->langcode])) { $data .= "'pluralFormula': function (\$n) { return Number({$locale_plurals[$language->langcode]['formula']}); }, "; } @@ -1240,7 +1240,7 @@ function _locale_rebuild_js($langcode = NULL) { $dir = 'public://' . $config->get('javascript.directory'); // Delete old file, if we have no translations anymore, or a different file to be saved. - $locale_javascripts = \Drupal::state()->get('locale.translation.javascript') ?: array(); + $locale_javascripts = Drupal::state()->get('locale.translation.javascript') ?: array(); $changed_hash = !isset($locale_javascripts[$language->langcode]) || ($locale_javascripts[$language->langcode] != $data_hash); if (!empty($locale_javascripts[$language->langcode]) && (!$data || $changed_hash)) { file_unmanaged_delete($dir . '/' . $language->langcode . '_' . $locale_javascripts[$language->langcode] . '.js'); @@ -1284,7 +1284,7 @@ function _locale_rebuild_js($langcode = NULL) { // deleted). Act only if some operation was executed that changed the hash // code. if ($status && $changed_hash) { - \Drupal::state()->set('locale.translation.javascript', $locale_javascripts); + Drupal::state()->set('locale.translation.javascript', $locale_javascripts); } // Log the operation and return success flag. diff --git a/core/modules/locale/locale.pages.inc b/core/modules/locale/locale.pages.inc index 0c1eedb..99af0a3 100644 --- a/core/modules/locale/locale.pages.inc +++ b/core/modules/locale/locale.pages.inc @@ -279,7 +279,7 @@ function locale_translate_edit_form($form, &$form_state) { if (isset($langcode)) { $strings = locale_translate_filter_load_strings(); - $plural_formulas = \Drupal::state()->get('locale.translation.plurals') ?: array(); + $plural_formulas = Drupal::state()->get('locale.translation.plurals') ?: array(); foreach ($strings as $string) { // Cast into source string, will do for our purposes. @@ -499,7 +499,7 @@ function locale_translation_status_form($form, &$form_state) { $project_data = locale_translation_build_projects(); $languages = locale_translatable_language_list(); $projects = locale_translation_get_projects(); - $status = \Drupal::state()->get('locale.translation_status'); + $status = Drupal::state()->get('locale.translation_status'); // Prepare information about projects which have available translation // updates. @@ -542,7 +542,7 @@ function locale_translation_status_form($form, &$form_state) { uasort($options, 'drupal_sort_title'); } - $last_checked = \Drupal::state()->get('locale.translation_last_checked'); + $last_checked = Drupal::state()->get('locale.translation_last_checked'); $form['last_checked'] = array( '#markup' => '
' . theme('locale_translation_last_check', array('last' => $last_checked)) . '
', ); @@ -619,7 +619,7 @@ function locale_translation_status_form_submit($form, &$form_state) { // If the status was updated recently we can immediately start fetching the // translation updates. If the status is expired we clear it an run a batch to // update the status and then fetch the translation updates. - $last_checked = \Drupal::state()->get('locale.translation_last_checked'); + $last_checked = Drupal::state()->get('locale.translation_last_checked'); if ($last_checked < REQUEST_TIME - LOCALE_TRANSLATION_STATUS_TTL) { locale_translation_clear_status(); $batch = locale_translation_batch_update_build(array(), $langcodes, $options); diff --git a/core/modules/locale/locale.translation.inc b/core/modules/locale/locale.translation.inc index 739f7fc..7d58315 100644 --- a/core/modules/locale/locale.translation.inc +++ b/core/modules/locale/locale.translation.inc @@ -104,7 +104,7 @@ function locale_translation_load_sources($projects = NULL, $langcodes = NULL) { $langcodes = $langcodes ? $langcodes : array_keys(locale_translatable_language_list()); // Load source data from locale_translation_status cache. - $status = \Drupal::state()->get('locale.translation_status'); + $status = Drupal::state()->get('locale.translation_status'); // Use only the selected projects and languages for update. foreach($projects as $project) { diff --git a/core/modules/locale/tests/modules/locale_test/locale_test.install b/core/modules/locale/tests/modules/locale_test/locale_test.install index be5ad52..e820b9f 100644 --- a/core/modules/locale/tests/modules/locale_test/locale_test.install +++ b/core/modules/locale/tests/modules/locale_test/locale_test.install @@ -10,6 +10,6 @@ */ function locale_test_uninstall() { // Clear variables. - \Drupal::state()->delete('locale.test_system_info_alter'); - \Drupal::state()->delete('locale.test_projects_alter'); + Drupal::state()->delete('locale.test_system_info_alter'); + Drupal::state()->delete('locale.test_projects_alter'); } diff --git a/core/modules/locale/tests/modules/locale_test/locale_test.module b/core/modules/locale/tests/modules/locale_test/locale_test.module index 0394232..ace4172 100644 --- a/core/modules/locale/tests/modules/locale_test/locale_test.module +++ b/core/modules/locale/tests/modules/locale_test/locale_test.module @@ -16,7 +16,7 @@ function locale_test_system_info_alter(&$info, $file, $type) { // By default the locale_test modules are hidden and have a project specified. // To test the module detection proces by locale_project_list() the // test modules should mimic a custom module. I.e. be non-hidden. - if (\Drupal::state()->get('locale.test_system_info_alter')) { + if (Drupal::state()->get('locale.test_system_info_alter')) { if ($file->name == 'locale_test' || $file->name == 'locale_test_translate') { // Don't hide the module. $info['hidden'] = FALSE; @@ -37,7 +37,7 @@ function locale_test_system_info_alter(&$info, $file, $type) { * test script in order for this hook to take effect. */ function locale_test_locale_translation_projects_alter(&$projects) { - if (\Drupal::state()->get('locale.test_projects_alter')) { + if (Drupal::state()->get('locale.test_projects_alter')) { // Instead of the default ftp.drupal.org we use the file system of the test // instance to simulate a remote file location. diff --git a/core/modules/node/node.install b/core/modules/node/node.install index d8c9bf9..527ceb0 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -438,12 +438,12 @@ function node_uninstall() { variable_del('node_rank_recent'); // Delete remaining general module variables. - \Drupal::state()->delete('node.node_access_needs_rebuild'); + Drupal::state()->delete('node.node_access_needs_rebuild'); variable_del('node_admin_theme'); variable_del('node_recent_block_count'); // Delete any stored state. - \Drupal::state()->delete('node.cron_last'); + Drupal::state()->delete('node.cron_last'); } /** diff --git a/core/modules/node/node.module b/core/modules/node/node.module index bc4bfca..82cbe84 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -1450,7 +1450,7 @@ function node_ranking() { ); // Add relevance based on creation or changed date. - if ($node_cron_last = \Drupal::state()->get('node.cron_last')) { + if ($node_cron_last = Drupal::state()->get('node.cron_last')) { $ranking['recent'] = array( 'title' => t('Recently posted'), // Exponential decay with half-life of 6 months, starting at last indexed node @@ -2241,7 +2241,7 @@ function _node_index_node(EntityInterface $node) { // Save the changed time of the most recent indexed node, for the search // results half-life calculation. - \Drupal::state()->set('node.cron_last', $node->changed); + Drupal::state()->set('node.cron_last', $node->changed); $languages = $node->getTranslationLanguages(); @@ -2970,13 +2970,13 @@ function _node_access_write_grants(EntityInterface $node, $grants, $realm = NULL */ function node_access_needs_rebuild($rebuild = NULL) { if (!isset($rebuild)) { - return \Drupal::state()->get('node.node_access_needs_rebuild') ?: FALSE; + return Drupal::state()->get('node.node_access_needs_rebuild') ?: FALSE; } elseif ($rebuild) { - \Drupal::state()->set('node.node_access_needs_rebuild', TRUE); + Drupal::state()->set('node.node_access_needs_rebuild', TRUE); } else { - \Drupal::state()->delete('node.node_access_needs_rebuild'); + Drupal::state()->delete('node.node_access_needs_rebuild'); } } diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module index d1363ad..0971750 100644 --- a/core/modules/node/tests/modules/node_access_test/node_access_test.module +++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module @@ -22,7 +22,7 @@ function node_access_test_node_grants($account, $op) { $grants['node_access_test'] = array(8888, 8889); } - $no_access_uid = \Drupal::state()->get('node_access_test.no_access_uid') ?: 0; + $no_access_uid = Drupal::state()->get('node_access_test.no_access_uid') ?: 0; if ($op == 'view' && $account->uid == $no_access_uid) { $grants['node_access_all'] = array(0); } @@ -35,7 +35,7 @@ function node_access_test_node_grants($account, $op) { function node_access_test_node_access_records(EntityInterface $node) { $grants = array(); // For NodeAccessBaseTableTestCase, only set records for private nodes. - if (!\Drupal::state()->get('node_access_test.private') || $node->private) { + if (!Drupal::state()->get('node_access_test.private') || $node->private) { $grants[] = array( 'realm' => 'node_access_test', 'gid' => 8888, @@ -182,7 +182,7 @@ function node_access_entity_test_page() { */ function node_access_test_form_node_form_alter(&$form, $form_state) { // Only show this checkbox for NodeAccessBaseTableTestCase. - if (\Drupal::state()->get('node_access_test.private')) { + if (Drupal::state()->get('node_access_test.private')) { $node = $form_state['controller']->getEntity($form_state); $form['private'] = array( '#type' => 'checkbox', @@ -241,7 +241,7 @@ function _node_access_test_node_write(EntityInterface $node) { * Implements hook_node_access(). */ function node_access_test_node_access($node, $op, $account, $langcode) { - $secret_catalan = \Drupal::state()->get('node_access_test_secret_catalan') ?: 0; + $secret_catalan = Drupal::state()->get('node_access_test_secret_catalan') ?: 0; if ($secret_catalan && $langcode == 'ca') { // Make all Catalan content secret. return NODE_ACCESS_DENY; diff --git a/core/modules/node/tests/modules/node_test/node_test.module b/core/modules/node/tests/modules/node_test/node_test.module index 394b5ce..3cb030a 100644 --- a/core/modules/node/tests/modules/node_test/node_test.module +++ b/core/modules/node/tests/modules/node_test/node_test.module @@ -160,7 +160,7 @@ function node_test_node_update(EntityInterface $node) { */ function node_test_entity_view_mode_alter(&$view_mode, Drupal\Core\Entity\EntityInterface $entity, $context) { // Only alter the view mode if we are on the test callback. - $change_view_mode = \Drupal::state()->get( 'node_test_change_view_mode') ?: ''; + $change_view_mode = Drupal::state()->get( 'node_test_change_view_mode') ?: ''; if ($change_view_mode) { $view_mode = $change_view_mode; } diff --git a/core/modules/openid/tests/openid_test.module b/core/modules/openid/tests/openid_test.module index d725075..8ff285b 100644 --- a/core/modules/openid/tests/openid_test.module +++ b/core/modules/openid/tests/openid_test.module @@ -108,7 +108,7 @@ function openid_test_yadis_xrds() { $output .= '' . t('Last run: %cron-last ago.', array('%cron-last' => format_interval(REQUEST_TIME - \Drupal::state()->get('system.cron_last')))) . '
'; + $status = '' . t('Last run: %cron-last ago.', array('%cron-last' => format_interval(REQUEST_TIME - Drupal::state()->get('system.cron_last')))) . '
'; $form['status'] = array( '#markup' => $status, ); $form['cron_url'] = array( - '#markup' => '' . t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . \Drupal::state()->get('system.cron_key'), array('absolute' => TRUE)))) . '
', + '#markup' => '' . t('To run cron from outside the site, go to !cron', array('!cron' => url('cron/' . Drupal::state()->get('system.cron_key'), array('absolute' => TRUE)))) . '
', ); $form['cron'] = array( diff --git a/core/modules/system/system.install b/core/modules/system/system.install index f83e669..4545359 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1,4 +1,4 @@ -configuring cron jobs.', array('@cron-handbook' => 'http://drupal.org/cron')); // Determine when cron last ran. - $cron_last = \Drupal::state()->get('system.cron_last'); + $cron_last = Drupal::state()->get('system.cron_last'); if (!is_numeric($cron_last)) { $cron_last = variable_get('install_time', 0); } @@ -294,7 +294,7 @@ function system_requirements($phase) { } $description .= ' ' . $t('You can run cron manually.', array('@cron' => url('admin/reports/status/run-cron'))); - $description .= '