-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Add editPreviewMode support for Neos 9.0
- Loading branch information
Showing
6 changed files
with
101 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Neos.Neos package. | ||
* | ||
* (c) Contributors of the Neos Project - www.neos.io | ||
* | ||
* This package is Open Source Software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\Domain\Model; | ||
|
||
final class EditPreviewMode | ||
{ | ||
protected function __construct( | ||
public readonly string $name, | ||
public readonly string $title, | ||
public readonly string $fusionPath, | ||
public readonly bool $isEditMode, | ||
public readonly bool $isPreviewMode | ||
) { | ||
} | ||
|
||
public static function fromNameAndConfiguration(string $name, array $configuration): self | ||
{ | ||
return new static( | ||
$name, | ||
$configuration['title'] ?? $name, | ||
$configuration['fusionRenderingPath'] ?? '', | ||
$configuration['isEditingMode'] ?? false, | ||
$configuration['isPreviewMode'] ?? false | ||
); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
Neos.Neos/Classes/Domain/Repository/EditPreviewModeRepository.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,37 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Neos.Neos package. | ||
* | ||
* (c) Contributors of the Neos Project - www.neos.io | ||
* | ||
* This package is Open Source Software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\Neos\Domain\Repository; | ||
|
||
use Neos\Neos\Domain\Model\EditPreviewMode; | ||
use Neos\Flow\Annotations as Flow; | ||
|
||
class EditPreviewModeRepository | ||
{ | ||
#[Flow\InjectConfiguration(path:"userInterface.defaultEditPreviewMode")] | ||
protected string $defaultEditPreviewMode; | ||
|
||
#[Flow\InjectConfiguration(path:"userInterface.editPreviewModes")] | ||
protected array $editPreviewModeConfigurations; | ||
|
||
public function findDefault(): EditPreviewMode | ||
{ | ||
return EditPreviewMode::fromNameAndConfiguration($this->defaultEditPreviewMode, $this->editPreviewModeConfigurations[$this->defaultEditPreviewMode]); | ||
} | ||
|
||
public function findByName(string $name): EditPreviewMode | ||
{ | ||
return EditPreviewMode::fromNameAndConfiguration($name, $this->editPreviewModeConfigurations[$name]); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
prototype(Neos.Fusion:GlobalCacheIdentifiers) { | ||
workspaceChain = ${Array.join(Array.keys(Neos.Caching.getWorkspaceChain(documentNode)), ',')} | ||
[email protected] = ${!!documentNode} | ||
editPreviewMode = ${editPreviewMode} | ||
editPreviewMode = ${editPreviewMode.name} | ||
} |
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