-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4622 - Allow other views than Fusion for out-of-band rendering
- Loading branch information
Bernhard Schmitt
committed
Oct 20, 2023
1 parent
d0435d8
commit 114c0e5
Showing
4 changed files
with
79 additions
and
15 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
Classes/Domain/Model/Feedback/Operations/OutOfBandRenderingViewFactory.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,55 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Neos.Neos.Ui 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\Ui\Domain\Model\Feedback\Operations; | ||
|
||
use Neos\Flow\Mvc\View\AbstractView; | ||
use Neos\Flow\Annotations as Flow; | ||
use Neos\Neos\View\RenderingEntryPointAware; | ||
|
||
class OutOfBandRenderingViewFactory | ||
{ | ||
/** | ||
* @phpstan-var class-string | ||
*/ | ||
#[Flow\InjectConfiguration(path: 'outOfBandRendering.viewObjectName')] | ||
protected string $viewObjectName; | ||
|
||
public function resolveView(): AbstractView&RenderingEntryPointAware | ||
{ | ||
if (!class_exists($this->viewObjectName)) { | ||
throw new \DomainException( | ||
'Declared view for out of band rendering (' . $this->viewObjectName . ') does not exist', | ||
1697821296 | ||
); | ||
} | ||
$view = new $this->viewObjectName(); | ||
if (!$view instanceof AbstractView) { | ||
throw new \DomainException( | ||
'Declared view (' . $this->viewObjectName . ') does not implement ' . AbstractView::class | ||
. ' required for out-of-band rendering', | ||
1697821429 | ||
); | ||
} | ||
if (!$view instanceof RenderingEntryPointAware) { | ||
throw new \DomainException( | ||
'Declared view (' . $this->viewObjectName . ') does not implement ' . RenderingEntryPointAware::class | ||
. ' required for out-of-band rendering', | ||
1697821364 | ||
); | ||
} | ||
|
||
return $view; | ||
} | ||
} |
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