-
-
Notifications
You must be signed in to change notification settings - Fork 31
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 #42 from bwaidelich/41-fix-43-compatibility
BUGFIX: Fix Neos 4.3 compatibility
- Loading branch information
Showing
5 changed files
with
49 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
namespace Neos\Form\Builder\Fusion\Helper; | ||
|
||
use Neos\ContentRepository\Domain\Model\NodeInterface; | ||
use Neos\Eel\ProtectedContextAwareInterface; | ||
|
||
/** | ||
* Custom Eel Helper for node related functions | ||
*/ | ||
class NodeHelper implements ProtectedContextAwareInterface | ||
{ | ||
|
||
/** | ||
* Merge properties of the specified $node to the given $properties (with precedence to node properties) | ||
* | ||
* Note: This is required since NodeInterface::getProperties() does no longer return an array but an instance of PropertyCollectionInterface | ||
* | ||
* @param array $properties | ||
* @param NodeInterface $node | ||
* @return array | ||
*/ | ||
public function mergeProperties(array $properties, NodeInterface $node): array | ||
{ | ||
$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; | ||
} | ||
} |
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 |
---|---|---|
@@ -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)} | ||
} | ||
} | ||
|
||
|
@@ -23,4 +23,4 @@ prototype(Neos.Form.Builder:NodeBasedFinisherCollection) < prototype(Neos.Fusion | |
} | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -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()} | ||
} | ||
|
@@ -43,4 +43,4 @@ prototype(Neos.Form.Builder:NodeBasedElementCollection) < prototype(Neos.Fusion: | |
} | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -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)} | ||
} | ||
} | ||
|
||
|
@@ -23,4 +23,4 @@ prototype(Neos.Form.Builder:NodeBasedValidatorCollection) < prototype(Neos.Fusio | |
} | ||
} | ||
} | ||
} | ||
} |