Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
367e1a88
Commit
367e1a88
authored
10 years ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2250491
by damiankloip: Remove duplicate methods from Settings class.
parent
e9696428
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/lib/Drupal/Core/Site/Settings.php
+13
-42
13 additions, 42 deletions
core/lib/Drupal/Core/Site/Settings.php
core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php
+1
-1
1 addition, 1 deletion
...rupal/Core/StringTranslation/Translator/CustomStrings.php
with
14 additions
and
43 deletions
core/lib/Drupal/Core/Site/Settings.php
+
13
−
42
View file @
367e1a88
...
...
@@ -28,6 +28,17 @@ final class Settings {
*/
private
static
$instance
;
/**
* Constructor.
*
* @param array $settings
* Array with the settings.
*/
public
function
__construct
(
array
$settings
)
{
$this
->
storage
=
$settings
;
self
::
$instance
=
$this
;
}
/**
* Returns the settings instance.
*
...
...
@@ -56,7 +67,7 @@ public static function getInstance() {
* The value of the setting, the provided default if not set.
*/
public
static
function
get
(
$name
,
$default
=
NULL
)
{
return
self
::
$instance
->
getSetting
(
$name
,
$default
)
;
return
isset
(
self
::
$instance
->
storage
[
$name
])
?
self
::
$instance
->
storage
[
$name
]
:
$default
;
}
/**
...
...
@@ -66,47 +77,7 @@ public static function get($name, $default = NULL) {
* All the settings.
*/
public
static
function
getAll
()
{
return
self
::
$instance
->
getAllSettings
();
}
/**
* Constructor.
*
* @param array $settings
* Array with the settings.
*/
function
__construct
(
array
$settings
)
{
$this
->
storage
=
$settings
;
self
::
$instance
=
$this
;
}
/**
* Returns a setting.
*
* Settings can be set in settings.php in the $settings array and requested
* by this function. Settings should be used over configuration for read-only,
* possibly low bootstrap configuration that is environment specific.
*
* @param string $name
* The name of the setting to return.
* @param mixed $default
* (optional) The default value to use if this setting is not set.
*
* @return mixed
* The value of the setting, the provided default if not set.
*/
public
function
getSetting
(
$name
,
$default
=
NULL
)
{
return
isset
(
$this
->
storage
[
$name
])
?
$this
->
storage
[
$name
]
:
$default
;
}
/**
* Returns all the settings. This is only used for testing purposes.
*
* @return array
* All the settings.
*/
public
function
getAllSettings
()
{
return
$this
->
storage
;
return
self
::
$instance
->
storage
;
}
}
This diff is collapsed.
Click to expand it.
core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php
+
1
−
1
View file @
367e1a88
...
...
@@ -39,7 +39,7 @@ public function __construct(Settings $settings) {
* {@inheritdoc}
*/
protected
function
getLanguage
(
$langcode
)
{
return
$this
->
settings
->
get
Setting
(
'locale_custom_strings_'
.
$langcode
,
array
());
return
$this
->
settings
->
get
(
'locale_custom_strings_'
.
$langcode
,
array
());
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment