Skip to content

Commit

Permalink
Merge pull request #55 from daniellienert/task/exchange-response-impl…
Browse files Browse the repository at this point in the history
…ementation

FEATURE: Neos 5.0 compatibility
  • Loading branch information
bwaidelich authored Nov 13, 2019
2 parents 5a835ee + 259c411 commit 2a68287
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
29 changes: 25 additions & 4 deletions Classes/Fusion/FormImplementation.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
<?php
declare(strict_types=1);

namespace Neos\Form\Builder\Fusion;

/*
* This file is part of the Neos.Form.Builder 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.
*/

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Http\Response;
use Neos\Flow\Mvc\ActionRequest;
use Neos\Form\Core\Model\FormDefinition;
use Neos\Form\Core\Model\Renderable\RenderableInterface;
Expand Down Expand Up @@ -35,12 +46,11 @@ public function evaluate()
$formDefinition->setRenderingOption('_fusionRuntime', $this->runtime);
$controllerContext = $this->runtime->getControllerContext();

$response = new Response($controllerContext->getResponse());
$actionRequest = $controllerContext->getRequest();
if (!$actionRequest instanceof ActionRequest) {
throw new \RuntimeException(sprintf('The Form ControllerContext requires an instance of ActionRequest, instance of "%s" given', get_class($controllerContext->getRequest())), 1499345873);
}
$formRuntime = $formDefinition->bind($actionRequest, $response);
$formRuntime = $formDefinition->bind($actionRequest, $controllerContext->getResponse());

$this->runtime->pushContext('formRuntime', $formRuntime);
$this->runtime->evaluate($this->path . '/renderCallbacks');
Expand All @@ -49,6 +59,12 @@ public function evaluate()
return $formRuntime->render();
}

/**
* @return FormDefinition
* @throws FusionException
* @throws PresetNotFoundException
* @throws \Neos\Form\Exception\IdentifierNotValidException
*/
protected function buildFormDefinition(): FormDefinition
{
$presetName = $this->getPresetName();
Expand All @@ -73,6 +89,11 @@ protected function buildFormDefinition(): FormDefinition
return $formDefinition;
}

/**
* @param string $presetName
* @return array
* @throws PresetNotFoundException
*/
private function getPresetConfiguration(string $presetName): array
{
if (!isset($this->formSettings['presets'][$presetName])) {
Expand Down Expand Up @@ -110,4 +131,4 @@ private function getRenderingOptions(): array
{
return $this->fusionValue('renderingOptions');
}
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "Flow Form Framework integration into Neos CMS",
"license": "GPL-3.0+",
"require": {
"neos/neos": "^3.1 || ^4.0",
"neos/form": "^4.1"
"neos/neos": "^5.0",
"neos/form": "^5.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 2a68287

Please sign in to comment.