Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
domain-3409936
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
domain-3409936
Commits
341c4227
Commit
341c4227
authored
1 year ago
by
Guiu Rocafort Ferrer
Browse files
Options
Downloads
Patches
Plain Diff
Added support for adding multiple domain overrides in languages
parent
c82f391b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
domain_config/src/DomainConfigOverrider.php
+20
-4
20 additions, 4 deletions
domain_config/src/DomainConfigOverrider.php
with
20 additions
and
4 deletions
domain_config/src/DomainConfigOverrider.php
+
20
−
4
View file @
341c4227
...
...
@@ -3,6 +3,7 @@
namespace
Drupal\domain_config
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\domain\DomainInterface
;
use
Drupal\Core\Cache\CacheableMetadata
;
use
Drupal\Core\Config\ConfigFactoryOverrideInterface
;
...
...
@@ -201,13 +202,21 @@ class DomainConfigOverrider implements ConfigFactoryOverrideInterface {
else
{
$domains
=
$this
->
domainStorage
->
loadMultiple
();
}
$languages
=
$this
->
languageManager
->
getLanguages
();
foreach
(
$names
as
$name
)
{
$result
[
$name
]
=
[];
/** @var DomainInterface $domain */
foreach
(
$domains
as
$domain
)
{
$configName
=
$this
->
getDomainConfigName
(
$name
,
$domain
);
if
(
$this
->
storage
->
exists
(
$configName
[
'domain'
]))
{
$result
[
$name
][
$domain
->
id
()]
=
$this
->
storage
->
read
(
$configName
[
'domain'
]);
$result
[
$name
][
$domain
->
id
()][
'default'
]
=
$this
->
storage
->
read
(
$configName
[
'domain'
]);
}
foreach
(
$languages
as
$language
)
{
$configName
=
$this
->
getDomainConfigName
(
$name
,
$domain
,
$language
);
if
(
$this
->
storage
->
exists
(
$configName
[
'langcode'
]))
{
$result
[
$name
][
$domain
->
id
()][
$language
->
getId
()]
=
$this
->
storage
->
read
(
$configName
[
'langcode'
]);
}
}
}
}
...
...
@@ -224,15 +233,22 @@ class DomainConfigOverrider implements ConfigFactoryOverrideInterface {
*
* @param string $name
* The name of the config object.
* @param
\Drupal\domain\
DomainInterface $domain
* @param DomainInterface $domain
* The domain object.
* @param LanguageInterface|null $language
* The language object.
*
* @return array
* The domain-language, and domain-specific config names.
*/
protected
function
getDomainConfigName
(
$name
,
DomainInterface
$domain
)
{
protected
function
getDomainConfigName
(
$name
,
DomainInterface
$domain
,
LanguageInterface
$language
=
NULL
)
{
if
(
$language
==
NULL
)
{
$language
=
$this
->
language
;
}
return
[
'langcode'
=>
'domain.config.'
.
$domain
->
id
()
.
'.'
.
$
this
->
language
->
getId
()
.
'.'
.
$name
,
'langcode'
=>
'domain.config.'
.
$domain
->
id
()
.
'.'
.
$language
->
getId
()
.
'.'
.
$name
,
'domain'
=>
'domain.config.'
.
$domain
->
id
()
.
'.'
.
$name
,
];
}
...
...
This diff is collapsed.
Click to expand it.
Guiu Rocafort Ferrer
@guiu.rocafort.ferrer
mentioned in commit
fe2d8a70
·
1 year ago
mentioned in commit
fe2d8a70
mentioned in commit fe2d8a702991daf0db015116a8a07bde57688b9d
Toggle commit list
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