-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK: Also adjust dnymaically loaded language constraints
- Loading branch information
1 parent
9ae830d
commit b93da28
Showing
7 changed files
with
124 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
Classes/Service/SiteSpecificContentDimensionPresetSource.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace PunktDe\SiteSpecifics\Service; | ||
|
||
/* | ||
* (c) 2021 punkt.de GmbH - Karlsruhe, Germany - http://punkt.de | ||
* All rights reserved. | ||
*/ | ||
|
||
use Neos\Flow\Annotations as Flow; | ||
use Neos\Neos\Domain\Service\ConfigurationContentDimensionPresetSource; | ||
|
||
/** | ||
* @Flow\Scope("singleton") | ||
*/ | ||
class SiteSpecificContentDimensionPresetSource extends ConfigurationContentDimensionPresetSource | ||
{ | ||
|
||
/** | ||
* @Flow\Inject | ||
* @var SiteDeterminationService | ||
*/ | ||
protected $siteDeterminationService; | ||
|
||
/** | ||
* @Flow\InjectConfiguration(package="PunktDe.SiteSpecifics") | ||
* @var array | ||
*/ | ||
protected $settings; | ||
|
||
protected bool $configurationAdjusted = false; | ||
|
||
public function initializeObject(): void | ||
{ | ||
$siteName = $this->siteDeterminationService->getCurrentSiteName(); | ||
|
||
if ($siteName !== null) { | ||
$this->alterPresetSourceForSite($siteName); | ||
} | ||
} | ||
|
||
public function alterPresetSourceForSite(string $siteName): void | ||
{ | ||
if ($this->configurationAdjusted) { | ||
return; | ||
} | ||
|
||
$dimensionSelectorOverride = $this->settings[$siteName]['dimensionSelector'] ?? null; | ||
|
||
if ($dimensionSelectorOverride === null) { | ||
return; | ||
} | ||
|
||
$this->configuration = DimensionCombinationService::adjustDimensionCombinations($this->configuration, $dimensionSelectorOverride); | ||
$this->configurationAdjusted = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'Neos\ContentRepository\Domain\Service\ContentDimensionPresetSourceInterface': | ||
className: PunktDe\SiteSpecifics\Service\SiteSpecificContentDimensionPresetSource | ||
|
||
'Neos\Neos\Domain\Service\ContentDimensionPresetSourceInterface': | ||
className: PunktDe\SiteSpecifics\Service\SiteSpecificContentDimensionPresetSource | ||
|
||
PunktDe\SiteSpecifics\Service\SiteSpecificContentDimensionPresetSource: | ||
properties: | ||
configuration: | ||
setting: Neos.ContentRepository.contentDimensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
- | ||
name: 'Services - ContentDimensionController->index() with site' | ||
uriPattern: 'content-dimensions/{site}' | ||
defaults: | ||
'@package': 'Neos.Neos' | ||
'@controller': 'Service\ContentDimensions' | ||
'@action': 'index' | ||
site: '' | ||
appendExceedingArguments: true | ||
httpMethods: ['GET'] | ||
|
||
- | ||
name: 'Services - ContentDimensionController->show() with site' | ||
uriPattern: 'content-dimensions/{site}/{dimensionName}(.{@format})' | ||
defaults: | ||
'@package': 'Neos.Neos' | ||
'@controller': 'Service\ContentDimensions' | ||
'@action': 'show' | ||
'@format': 'html' | ||
site: '' | ||
appendExceedingArguments: true | ||
httpMethods: ['GET'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
backend.configuration.endpoints.nodeTypeSchema.arguments.site = ${site.context.currentSite.name} | ||
backend.configuration.endpoints.nodeTypeSchema.arguments.version.@process.addsite = ${value + '_' + String.md5(site.context.currentSite.name)} | ||
backend { | ||
configuration.endpoints.nodeTypeSchema.arguments.site = ${site.context.currentSite.name} | ||
configuration.endpoints.nodeTypeSchema.arguments.version.@process.addsite = ${value + '_' + String.md5(site.context.currentSite.name)} | ||
|
||
routes.core.service.contentDimensions.arguments.site = ${site.context.currentSite.name} | ||
} |