Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
3cf100df
Commit
3cf100df
authored
Aug 14, 2013
by
Angie Byron
Browse files
Issue
#1957142
by damiankloip, fubhy, cosmicdreams: Replace config() with Drupal::config().
parent
858674f0
Changes
334
Hide whitespace changes
Inline
Side-by-side
core/includes/ajax.inc
View file @
3cf100df
...
...
@@ -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
===
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
(
config
(
'system.maintenance'
)
->
get
(
'message'
),
array
(
'@site'
=>
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
;
}
}
...
...
core/includes/authorize.inc
View file @
3cf100df
...
...
@@ -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
=
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
=
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.
config
(
'system.authorize'
)
->
set
(
'filetransfer_default'
,
$filetransfer_backend
);
Drupal
::
config
(
'system.authorize'
)
->
set
(
'filetransfer_default'
,
$filetransfer_backend
);
// Save the connection settings minus the password.
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
]);
...
...
core/includes/bootstrap.inc
View file @
3cf100df
...
...
@@ -1220,7 +1220,7 @@ function drupal_page_header() {
* response is sent.
*/
function
drupal_serve_page_from_cache
(
stdClass
$cache
,
Response
$response
,
Request
$request
)
{
$config
=
config
(
'system.performance'
);
$config
=
Drupal
::
config
(
'system.performance'
);
// First half: we must determine if we should be returning a 304.
...
...
@@ -1878,7 +1878,7 @@ function drupal_handle_request($test_only = FALSE) {
*/
function
drupal_get_user_timezone
()
{
global
$user
;
$config
=
config
(
'system.date'
);
$config
=
Drupal
::
config
(
'system.date'
);
if
(
$user
&&
$config
->
get
(
'timezone.user.configurable'
)
&&
$user
->
isAuthenticated
()
&&
$user
->
getTimezone
())
{
return
$user
->
getTimezone
();
...
...
@@ -1975,7 +1975,7 @@ function _drupal_bootstrap_configuration() {
// Load the procedural configuration system helper functions.
require_once
__DIR__
.
'/config.inc'
;
// Set the Drupal custom error handler. (requires config())
// Set the Drupal custom error handler. (requires
Drupal::
config())
set_error_handler
(
'_drupal_error_handler'
);
set_exception_handler
(
'_drupal_exception_handler'
);
...
...
@@ -2013,7 +2013,7 @@ function _drupal_bootstrap_page_cache() {
}
else
{
drupal_bootstrap
(
DRUPAL_BOOTSTRAP_VARIABLES
,
FALSE
);
$config
=
config
(
'system.performance'
);
$config
=
Drupal
::
config
(
'system.performance'
);
$cache_enabled
=
$config
->
get
(
'cache.page.use_internal'
);
}
...
...
@@ -2382,7 +2382,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
());
}
...
...
@@ -2442,7 +2442,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
=
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'
],
...
...
core/includes/common.inc
View file @
3cf100df
...
...
@@ -1860,7 +1860,7 @@ function drupal_pre_render_styles($elements) {
$css_assets
=
$elements
[
'#items'
];
// Aggregate the CSS if necessary, but only during normal site operation.
if
(
!
defined
(
'MAINTENANCE_MODE'
)
&&
config
(
'system.performance'
)
->
get
(
'css.preprocess'
))
{
if
(
!
defined
(
'MAINTENANCE_MODE'
)
&&
Drupal
::
config
(
'system.performance'
)
->
get
(
'css.preprocess'
))
{
$css_assets
=
\
Drupal
::
service
(
'asset.css.collection_optimizer'
)
->
optimize
(
$css_assets
);
}
return
\
Drupal
::
service
(
'asset.css.collection_renderer'
)
->
render
(
$css_assets
);
...
...
@@ -1883,7 +1883,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
)
>
config
(
'system.performance'
)
->
get
(
'stale_file_threshold'
))
{
if
(
REQUEST_TIME
-
filemtime
(
$uri
)
>
Drupal
::
config
(
'system.performance'
)
->
get
(
'stale_file_threshold'
))
{
file_unmanaged_delete
(
$uri
);
}
}
...
...
@@ -2487,7 +2487,7 @@ function drupal_pre_render_scripts($elements) {
// Aggregate the JavaScript if necessary, but only during normal site
// operation.
if
(
!
defined
(
'MAINTENANCE_MODE'
)
&&
config
(
'system.performance'
)
->
get
(
'js.preprocess'
))
{
if
(
!
defined
(
'MAINTENANCE_MODE'
)
&&
Drupal
::
config
(
'system.performance'
)
->
get
(
'js.preprocess'
))
{
$js_assets
=
\
Drupal
::
service
(
'asset.js.collection_optimizer'
)
->
optimize
(
$js_assets
);
}
return
\
Drupal
::
service
(
'asset.js.collection_renderer'
)
->
render
(
$js_assets
);
...
...
@@ -3119,7 +3119,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
...
...
core/includes/config.inc
View file @
3cf100df
...
...
@@ -52,7 +52,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
)
{
config
(
$config_name
)
->
delete
();
Drupal
::
config
(
$config_name
)
->
delete
();
}
}
...
...
@@ -72,8 +72,7 @@ function config_get_storage_names_with_prefix($prefix = '') {
* @code config('book.admin') @endcode will return a configuration object in
* which the book module can store its administrative settings.
*
* @deprecated This function has been replaced by the \Drupal::config() method.
* Use that 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
...
...
@@ -84,7 +83,7 @@ function config_get_storage_names_with_prefix($prefix = '') {
* A configuration object.
*/
function
config
(
$name
)
{
return
d
rupal
_container
()
->
get
(
'config.factory'
)
->
get
(
$name
);
return
D
rupal
::
config
(
$name
);
}
/**
...
...
@@ -92,7 +91,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 config() until
* Calling this function affects all subsequent calls to
Drupal::
config() until
* config_context_leave() is called.
*
* @see config_context_leave()
...
...
core/includes/entity.api.php
View file @
3cf100df
...
...
@@ -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
=
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
=
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
]);
...
...
core/includes/file.inc
View file @
3cf100df
...
...
@@ -312,7 +312,7 @@ function file_uri_target($uri) {
* 'public', 'private' or any other file scheme defined as the default.
*/
function
file_default_scheme
()
{
return
config
(
'system.file'
)
->
get
(
'default_scheme'
);
return
Drupal
::
config
(
'system.file'
)
->
get
(
'default_scheme'
);
}
/**
...
...
@@ -514,7 +514,7 @@ function file_prepare_directory(&$directory, $options = FILE_MODIFY_PERMISSIONS)
*/
function
file_ensure_htaccess
()
{
file_save_htaccess
(
'public://'
,
FALSE
);
$private_path
=
config
(
'system.file'
)
->
get
(
'path.private'
);
$private_path
=
Drupal
::
config
(
'system.file'
)
->
get
(
'path.private'
);
if
(
!
empty
(
$private_path
))
{
file_save_htaccess
(
'private://'
,
TRUE
);
}
...
...
@@ -801,7 +801,7 @@ function file_munge_filename($filename, $extensions, $alerts = TRUE) {
$original
=
$filename
;
// Allow potentially insecure uploads for very savvy users and admin
if
(
!
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
);
...
...
@@ -1271,13 +1271,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
(
config
(
'system.file'
)
->
get
(
'chmod.directory'
));
$mode
=
octdec
(
Drupal
::
config
(
'system.file'
)
->
get
(
'chmod.directory'
));
if
(
!
$mode
)
{
$mode
=
0775
;
}
}
else
{
$mode
=
octdec
(
config
(
'system.file'
)
->
get
(
'chmod.file'
));
$mode
=
octdec
(
Drupal
::
config
(
'system.file'
)
->
get
(
'chmod.file'
));
if
(
!
$mode
)
{
$mode
=
0664
;
}
...
...
@@ -1455,7 +1455,7 @@ function drupal_mkdir($uri, $mode = NULL, $recursive = FALSE, $context = NULL) {
$mode
=
FALSE
;
// During early update there's no container.
if
(
is_object
(
Drupal
::
getContainer
()))
{
$mode
=
octdec
(
config
(
'system.file'
)
->
get
(
'chmod.directory'
));
$mode
=
octdec
(
Drupal
::
config
(
'system.file'
)
->
get
(
'chmod.directory'
));
}
if
(
!
$mode
)
{
$mode
=
0775
;
...
...
@@ -1607,7 +1607,7 @@ function drupal_tempnam($directory, $prefix) {
* A string containing the path to the temporary directory.
*/
function
file_directory_temp
()
{
$config
=
config
(
'system.file'
);
$config
=
Drupal
::
config
(
'system.file'
);
$temporary_directory
=
$config
->
get
(
'path.temporary'
);
if
(
empty
(
$temporary_directory
))
{
$temporary_directory
=
file_directory_os_temp
();
...
...
core/includes/form.inc
View file @
3cf100df
...
...
@@ -4574,7 +4574,7 @@ function form_process_weight($element) {
$element
[
'#is_weight'
]
=
TRUE
;
// If the number of options is small enough, use a select field.
$max_elements
=
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
++
)
{
...
...
core/includes/install.core.inc
View file @
3cf100df
...
...
@@ -2442,7 +2442,7 @@ function _install_configure_form($form, &$form_state, &$install_state) {
'#type'
=>
'select'
,
'#title'
=>
t
(
'Default country'
),
'#empty_value'
=>
''
,
'#default_value'
=>
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
,
...
...
@@ -2509,13 +2509,13 @@ function install_configure_form_validate($form, &$form_state) {
function
install_configure_form_submit
(
$form
,
&
$form_state
)
{
global
$user
;
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
();
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
();
...
...
@@ -2527,7 +2527,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
])
{
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
();
}
}
...
...
core/includes/install.inc
View file @
3cf100df
...
...
@@ -633,7 +633,7 @@ function drupal_install_system() {
// 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.
config
(
'system.module'
)
Drupal
::
config
(
'system.module'
)
->
set
(
'enabled.system'
,
0
)
->
save
();
...
...
core/includes/language.inc
View file @
3cf100df
...
...
@@ -192,7 +192,7 @@ function language_types_get_configurable() {
*/
function
language_types_disable
(
$types
)
{
$configurable
=
language_types_get_configurable
();
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
=
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
();
...
...
@@ -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
)
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
;
...
...
core/includes/mail.inc
View file @
3cf100df
...
...
@@ -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
=
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'
);
...
...
@@ -268,7 +268,7 @@ function drupal_mail_system($module, $key) {
$id
=
$module
.
'_'
.
$key
;
$configuration
=
config
(
'system.mail'
)
->
get
(
'interface'
);
$configuration
=
Drupal
::
config
(
'system.mail'
)
->
get
(
'interface'
);
// Look for overrides for the default class, starting from the most specific
// id, and falling back to the module name.
...
...
core/includes/menu.inc
View file @
3cf100df
...
...
@@ -1821,7 +1821,7 @@ function menu_list_system_menus() {
* Returns an array of links to be rendered as the Main menu.
*/
function
menu_main_menu
()
{
$config
=
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'
;
...
...
@@ -1832,7 +1832,7 @@ function menu_main_menu() {
* Returns an array of links to be rendered as the Secondary links.
*/
function
menu_secondary_menu
()
{
$config
=
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'
;
...
...
@@ -2376,7 +2376,7 @@ function menu_set_active_menu_names($menu_names = NULL) {
$active
=
$menu_names
;
}
elseif
(
!
isset
(
$active
))
{
$config
=
config
(
'system.menu'
);
$config
=
Drupal
::
config
(
'system.menu'
);
$active
=
$config
->
get
(
'active_menus_default'
)
?:
array_keys
(
menu_list_system_menus
());
}
return
$active
;
...
...
@@ -3398,7 +3398,7 @@ function _menu_router_save($menu, $masks) {
*/
function
_menu_site_is_offline
(
$check_only
=
FALSE
)
{
// Check if site is in maintenance mode.
if
(
config
(
'system.maintenance'
)
->
get
(
'enabled'
))
{
if
(
Drupal
::
config
(
'system.maintenance'
)
->
get
(
'enabled'
))
{
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
...
...
core/includes/module.inc
View file @
3cf100df
...
...
@@ -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 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,7 +39,7 @@ function system_list($type) {
'filepaths'
=>
array
(),
);
// Build a list of themes.
$enabled_themes
=
(
array
)
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.
...
...
@@ -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
=
config
(
'system.module'
);
$module_config
=
Drupal
::
config
(
'system.module'
);
if
(
$module_config
->
get
(
"enabled.
$module
"
)
!==
NULL
)
{
$module_config
->
set
(
"enabled.
$module
"
,
$weight
)
...
...
@@ -345,7 +345,7 @@ function module_set_weight($module, $weight) {
$module_handler
->
setModuleList
(
$module_filenames
);
return
;
}
$disabled_config
=
config
(
'system.module.disabled'
);
$disabled_config
=
Drupal
::
config
(
'system.module.disabled'
);
if
(
$disabled_config
->
get
(
$module
)
!==
NULL
)
{
$disabled_config
->
set
(
$module
,
$weight
)
...
...
core/includes/path.inc
View file @
3cf100df
...
...
@@ -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
()
==
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
(
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
)
.
')$/'
;
...
...
core/includes/theme.inc
View file @
3cf100df
...
...
@@ -96,7 +96,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
:
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.
...
...
@@ -1463,8 +1463,8 @@ function theme_settings_convert_to_config(array $theme_settings, Config $config)
*/
function
theme_enable
(
$theme_list
)
{
drupal_clear_css_cache
();
$theme_config
=
config
(
'system.theme'
);
$disabled_themes
=
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
)
{
...
...
@@ -1500,7 +1500,7 @@ function theme_enable($theme_list) {
*/
function
theme_disable
(
$theme_list
)
{
// Don't disable the default theme.
if
(
$pos
=
array_search
(
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
;
...
...
@@ -1509,8 +1509,8 @@ function theme_disable($theme_list) {
drupal_clear_css_cache
();
$theme_config
=
config
(
'system.theme'
);
$disabled_themes
=
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
"
);
...
...
@@ -2551,7 +2551,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
=
config
(
'system.site'
);
$site_config
=
Drupal
::
config
(
'system.site'
);
// Construct page title.
if
(
drupal_get_title
())
{
$head_title
=
array
(
...
...
@@ -2643,7 +2643,7 @@ function template_preprocess_html(&$variables) {
*/
function
template_preprocess_page
(
&
$variables
)
{
$language_interface
=
language
(
Language
::
TYPE_INTERFACE
);
$site_config
=
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'
];
...
...
@@ -2840,7 +2840,7 @@ function template_preprocess_maintenance_page(&$variables) {
$variables
[
'layout'
]
=
(
$variables
[
'layout'
]
==
'first'
)
?
'both'
:
'second'
;
}
$site_config
=
config
(
'system.site'
);
$site_config
=
Drupal
::
config
(
'system.site'
);
$site_name
=
$site_config
->
get
(
'name'
);
$site_slogan
=
$site_config
->
get
(
'slogan'
);
...
...
core/includes/update.inc
View file @
3cf100df
...
...
@@ -32,7 +32,7 @@
*/
function
update_fix_compatibility
()
{
foreach
(
array
(
'module'
,
'theme'
)
as
$type
)
{
$config
=
config
(
"system.
$type
"
);
$config
=
Drupal
::
config
(
"system.
$type
"
);
$save
=
FALSE
;
foreach
(
$config
->
get
(
'enabled'
)
as
$name
=>
$weight
)
{
if
(
update_check_incompatibility
(
$name
,
$type
))
{
...
...
@@ -334,10 +334,10 @@ function update_prepare_d8_bootstrap() {
variable_set
(
'language_default'
,
(
array
)
$language_default
);
}
$module_config
=
config
(
'system.module'
);
$disabled_modules
=
config
(
'system.module.disabled'
);
$theme_config
=
config
(
'system.theme'
);
$disabled_themes
=
config
(
'system.theme.disabled'
);
$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
...
...
@@ -494,7 +494,7 @@ function update_prepare_d8_language() {
}
Drupal
::
state
()
->
set
(
'locale.translation.plurals'
,
$plurals
);
Drupal
::
state
()
->
set
(
'locale.translation.javascript'
,
$javascript
);
config
(
'language.negotiation'
)
Drupal
::
config
(
'language.negotiation'
)
->
set
(
'url.prefixes'
,
$prefixes
)
->
set
(
'url.domains'
,
$domains
)
->
save
();
...
...
@@ -573,7 +573,7 @@ function update_prepare_d8_language() {
$result
=
db_query
(
'SELECT * FROM {language}'
);
$uuid
=
new
Uuid
();
foreach
(
$result
as
$language
)
{
config
(
'language.entity.'
.
$language
->
langcode
)
Drupal
::
config
(
'language.entity.'
.
$language
->
langcode
)
->
set
(
'id'
,
$language
->
langcode
)
->
set
(
'uuid'
,
$uuid
->
generate
())
->
set
(
'label'
,
$language
->
name
)
...
...
@@ -710,7 +710,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 config().
// the limited standard tools of raw database queries and
Drupal::
config().
module_enable
(
array
(
'views'
));
update_variable_set
(
'update_d8_requirements'
,
TRUE
);
...
...
@@ -858,7 +858,7 @@ 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
=
config
(
'system.maintenance'
)
->
get
(
'enabled'
);
$maintenance_mode
=
Drupal
::
config
(
'system.maintenance'
)
->
get
(
'enabled'
);
if
(
isset
(
$maintenance_mode
))
{
$_SESSION
[
'maintenance_mode'
]
=
$maintenance_mode
;
}
...
...
@@ -867,7 +867,7 @@ function update_batch($start, $redirect = NULL, $url = NULL, $batch = array(), $
// @todo This is borderline state, not config. Or a global system
// "maintenance lock".
if
(
db_table_exists
(
'config'
))
{
config
(
'system.maintenance'
)
->
set
(
'enabled'
,
TRUE
)
->
save
();
Drupal
::
config
(
'system.maintenance'
)
->
set
(
'enabled'
,
TRUE
)
->
save
();
}
}
...
...
@@ -941,7 +941,7 @@ function update_finished($success, $results, $operations) {
if
(
isset
(
$_SESSION
[
'maintenance_mode'
]))
{
$GLOBALS
[
'conf'
][
'system.maintenance'
][
'enabled'
]
=
FALSE
;
// At this point, the configuration system should exist.
config
(
'system.maintenance'
)
->
set
(
'enabled'
,
FALSE
)
->
save
();
Drupal
::
config
(
'system.maintenance'
)
->
set
(
'enabled'
,
FALSE
)
->
save
();
unset
(
$_SESSION
[
'maintenance_mode'
]);
}
}
...
...
@@ -1405,7 +1405,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
=
config
(
$config_name
);
$config
=
Drupal
::
config
(
$config_name
);
$original_data
=
$config
->
get
();
// Extract the module namespace/owner from the configuration object name.
...
...
@@ -1435,7 +1435,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
// 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
);
...
...
@@ -1636,7 +1636,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
=
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'
],
...
...
core/lib/Drupal.php
View file @
3cf100df
...
...
@@ -207,12 +207,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