Skip to content

Commit

Permalink
WIP: BUGFIX: Fix Neos 4.3 compatibility
Browse files Browse the repository at this point in the history
Fixes: #41
  • Loading branch information
bwaidelich committed Apr 24, 2019
1 parent 5730117 commit 91e26f3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 7 deletions.
27 changes: 27 additions & 0 deletions Classes/Fusion/Helper/NodeHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
namespace Neos\Form\Builder\Fusion\Helper;

use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\Eel\ProtectedContextAwareInterface;

class NodeHelper implements ProtectedContextAwareInterface
{

public function mergeProperties(array $properties, NodeInterface $node)
{
$nodeProperties = $node->getProperties();
if ($nodeProperties instanceof \Traversable) {
$nodeProperties = iterator_to_array($nodeProperties);
}
return array_merge($properties, $nodeProperties);
}

/**
* @param string $methodName
* @return boolean
*/
public function allowsCallOfMethod($methodName): bool
{
return true;
}
}
5 changes: 4 additions & 1 deletion Configuration/Settings.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Neos:
Fusion:
defaultContext:
Neos.Form.Builder.Node: 'Neos\Form\Builder\Fusion\Helper\NodeHelper'
Neos:
fusion:
autoInclude:
Expand Down Expand Up @@ -34,4 +37,4 @@ Neos:
collapsed: false
'form.selectOptions':
label: 'Select options'
collapsed: false
collapsed: false
4 changes: 2 additions & 2 deletions Resources/Private/Fusion/NodeBased/NodeBasedFinisher.fusion
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prototype(Neos.Form.Builder:NodeBasedFinisher) < prototype(Neos.Fusion:Renderer) {
element {
@context.finisher = ${this}
[email protected] = ${Array.concat(value, finisherNode.properties)}
[email protected] = ${Neos.Form.Builder.Node.mergeProperties(value, finisherNode)}
}
}

Expand All @@ -23,4 +23,4 @@ prototype(Neos.Form.Builder:NodeBasedFinisherCollection) < prototype(Neos.Fusion
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ prototype(Neos.Form.Builder:NodeBasedFormElement) < prototype(Neos.Fusion:Render
label = ${elementNode.properties.label}
required = ${elementNode.properties.required}
defaultValue = ${elementNode.properties.defaultValue}
[email protected] = ${Array.concat(value, elementNode.properties)}
[email protected] = ${Neos.Form.Builder.Node.mergeProperties(value, elementNode)}
validators = Neos.Form.Builder:NodeBasedValidatorCollection {
collection = ${q(elementNode).children('validators').children()}
}
Expand Down Expand Up @@ -43,4 +43,4 @@ prototype(Neos.Form.Builder:NodeBasedElementCollection) < prototype(Neos.Fusion:
}
}
}
}
}
4 changes: 2 additions & 2 deletions Resources/Private/Fusion/NodeBased/NodeBasedValidator.fusion
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prototype(Neos.Form.Builder:NodeBasedValidator) < prototype(Neos.Fusion:Renderer) {
element {
@context.validator = ${this}
[email protected] = ${Array.concat(value, validatorNode.properties)}
[email protected] = ${Neos.Form.Builder.Node.mergeProperties(value, validatorNode)}
}
}

Expand All @@ -23,4 +23,4 @@ prototype(Neos.Form.Builder:NodeBasedValidatorCollection) < prototype(Neos.Fusio
}
}
}
}
}

0 comments on commit 91e26f3

Please sign in to comment.