Works well, for the specified node, but now I need to take it to its final form and make the identifier dynamic, any idea how I can do that ?
Attempt 1:
// The following does NOT work, it generates an array with key 'myVar', assuming a context variable myVar exists.
additionalParams = ${{myVar: {'@package': 'vendor.site.package', '@controller':'myCont', '@action': 'myAct'}}}
Attempt 2:
// The following does NOT work either, it results in an empty URI
additionalParams = ${{node.identifier: {'@package': 'vendor.site.package', '@controller':'myCont', '@action': 'myAct'}}}
Attempt 3 (by Rene):
// The following does NOT work either, it results in an empty URI
additionalParams = Neos.Fusion:RawArray {
node.identifier = Neos.Fusion:RawArray {
'@package' = 'vendor.site.plugin'
'@controller' = 'myCont'
'@action' = 'myAct'
}
}
Well, since noone answered, I went ahead and overkilled this little problem with a fusion object. I’m sharing the solution, but please don’t close this topic, I would be very interested to hear a native Fusion solution.
Classes/Fusion/ArrayIndexImplementation.php
namespace Vendor\Site\Package\Fusion;
use Neos\Flow\Annotations as Flow;
use Neos\Fusion\FusionObjects\AbstractFusionObject;
class ArrayIndexImplementation extends AbstractFusionObject
{
/**
* Render the single-index array as defined in fusion.
*
* @return array
*/
public function evaluate()
{
$key = $this->fusionValue('key');
$value = $this->fusionValue('value');
return [
$key => $value,
];
}
}
This will work for an array with a single key. If you want to have more than one key/value pair, this won’t work, or am i wrong? So this will only work in your one special case.