-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FEATURE: Implement edit preview mode for Neos 9
The main change is that edit and preview action are now separated with distinct constraints. - NodeController: has separate edit and preview actions that take the previewMode as argument - NodeUriBuilder and LinkingService: will use preview / edit action once the main request is from the same action - Neos.BackendHelper: has additional methods isEditMode, isPreviewMode and editPreviewModeCacheIdentifier
- Loading branch information
Showing
13 changed files
with
268 additions
and
19 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
Neos.Neos/Classes/Controller/Exception/InvalidEditPreviewModeException.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,25 @@ | ||
<?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\Controller\Exception; | ||
|
||
use Neos\Neos\Controller\Exception; | ||
|
||
/** | ||
* A "Node Creation" exception | ||
* | ||
*/ | ||
class InvalidEditPreviewModeException extends Exception | ||
{ | ||
} |
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,43 @@ | ||
<?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 | ||
) { | ||
} | ||
|
||
/** | ||
* @param string $name | ||
* @param array{'title'?:string, 'fusionRenderingPath'?:string, 'isEditingMode'?:bool, 'isPreviewMode'?:bool} $configuration | ||
* @return self | ||
*/ | ||
public static function fromNameAndConfiguration(string $name, array $configuration): self | ||
{ | ||
return new static( | ||
$name, | ||
$configuration['title'] ?? $name, | ||
$configuration['fusionRenderingPath'] ?? null, | ||
$configuration['isEditingMode'] ?? false, | ||
$configuration['isPreviewMode'] ?? false | ||
); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
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,43 @@ | ||
<?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; | ||
|
||
/** | ||
* @var array<string, array{'title'?:string, 'fusionRenderingPath'?:string, 'isEditingMode'?:bool, 'isPreviewMode'?:bool}> | ||
*/ | ||
#[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 | ||
{ | ||
if (array_key_exists($name,$this->editPreviewModeConfigurations)) { | ||
return EditPreviewMode::fromNameAndConfiguration($name, $this->editPreviewModeConfigurations[$name]); | ||
} | ||
return null; | ||
} | ||
} |
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
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
Oops, something went wrong.