-
-
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.
Merge pull request #4505 from neos/90/editPreviewModeSupport_v3
!!! FEATURE: Reimplement EditPreviewModes for Neos 9
- Loading branch information
Showing
16 changed files
with
237 additions
and
327 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,80 @@ | ||
<?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; | ||
|
||
use Neos\Neos\Domain\Exception; | ||
|
||
/** | ||
* Describes the mode in which the Neos interface is rendering currently, | ||
* mainly distinguishing between edit and preview modes currently. | ||
*/ | ||
class RenderingMode | ||
{ | ||
public const FRONTEND = 'frontend'; | ||
|
||
/** | ||
* @param array<string,mixed> $options | ||
*/ | ||
public function __construct( | ||
public readonly string $name, | ||
public readonly bool $isEdit, | ||
public readonly bool $isPreview, | ||
public readonly string $title, | ||
public readonly string $fusionPath, | ||
public readonly array $options | ||
) { | ||
} | ||
|
||
/** | ||
* Creates a rendering mode from its configuration | ||
* | ||
* @param string $modeName | ||
* @param array<string,mixed> $configuration | ||
*/ | ||
public static function createFromConfiguration(string $modeName, array $configuration): RenderingMode | ||
{ | ||
if ($modeName === RenderingMode::FRONTEND) { | ||
throw new Exception( | ||
'Cannot instantiate system rendering mode "frontend" from configuration.' | ||
. ' Please use RenderingMode::createFrontend().', | ||
1694802951840 | ||
); | ||
} | ||
$mode = new RenderingMode( | ||
$modeName, | ||
$configuration['isEditingMode'] ?? false, | ||
$configuration['isPreviewMode'] ?? false, | ||
$configuration['title'] ?? $modeName, | ||
$configuration['fusionRenderingPath'] ?? '', | ||
$configuration['options'] ?? [], | ||
); | ||
return $mode; | ||
} | ||
|
||
/** | ||
* Creates the system integrated rendering mode 'frontend' | ||
*/ | ||
public static function createFrontend(): RenderingMode | ||
{ | ||
return new RenderingMode( | ||
RenderingMode::FRONTEND, | ||
false, | ||
false, | ||
'Frontend', | ||
'', | ||
[] | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.