-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathNodeInfoPostProcessingAspect.php
37 lines (32 loc) · 1.28 KB
/
NodeInfoPostProcessingAspect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php declare(strict_types=1);
namespace Sitegeist\InspectorGadget\Infrastructure\NodeInfo;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Aop\JoinPointInterface;
/**
* @Flow\Aspect
*/
final class NodeInfoPostProcessingAspect
{
/**
* @Flow\Around("method(Neos\Neos\Ui\Fusion\Helper\NodeInfoHelper->renderNodeWithPropertiesAndChildrenInformation())")
* @param JoinPointInterface $joinPoint
* @return array<mixed>|null
*/
public function postProcessRenderNodeWithPropertiesAndChildrenInformation(
JoinPointInterface $joinPoint
) {
$node = $joinPoint->getMethodArgument('node');
$nodeType = $node->getNodeType();
/** @var array<mixed>|null $result */
$result = $joinPoint->getAdviceChain()->proceed($joinPoint);
foreach ($result['properties'] ?? [] as $propertyName => &$convertedValue) {
$editorName = $nodeType->getConfiguration(
sprintf('properties.%s.ui.inspector.editor', $propertyName)
);
if ($editorName === 'Sitegeist.InspectorGadget/Inspector/Editor' && $node->getProperty($propertyName) instanceof \JsonSerializable) {
$result['properties'][$propertyName] = $node->getProperty($propertyName);
}
}
return $result;
}
}