Skip to content

Commit

Permalink
Feature: Use separate references in ClientEval
Browse files Browse the repository at this point in the history
  • Loading branch information
pKallert committed Jun 24, 2024
1 parent f441113 commit d0ed939
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
19 changes: 16 additions & 3 deletions Classes/Domain/Service/NodePropertyConverterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private function getProperty(Node $node, string $propertyName): mixed
}

/**
* Get all properties and references stuff reduced to simple type (no objects) representations in an array
* Get all properties information reduced to simple type (no objects) representations in an array
*
* @param Node $node
* @return array<string,mixed>
Expand All @@ -181,10 +181,23 @@ public function getPropertiesArray(Node $node)

$properties[$propertyName] = $this->getProperty($node, $propertyName);
}
return $properties;
}

/**
* Get all references information reduced to simple type (no objects) representations in an array
*
* @param Node $node
* @return array<string,mixed>
*/
public function getReferencesArray(Node $node)
{
$references = [];

foreach ($this->getNodeType($node)->getReferences() as $referenceName => $_) {
$properties[$referenceName] = $this->getReference($node, $referenceName);
$references[$referenceName] = $this->getReference($node, $referenceName);
}
return $properties;
return $references;
}

/**
Expand Down
1 change: 1 addition & 0 deletions Classes/Fusion/Helper/NodeInfoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public function renderNodeWithPropertiesAndChildrenInformation(

$nodeInfo = $this->getBasicNodeInformation($node);
$nodeInfo['properties'] = $this->nodePropertyConverterService->getPropertiesArray($node);
$nodeInfo['references'] = $this->nodePropertyConverterService->getReferencesArray($node);
$nodeInfo['tags'] = $node->tags;
$nodeInfo['isFullyLoaded'] = true;

Expand Down
3 changes: 3 additions & 0 deletions packages/neos-ts-interfaces/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export interface Node {
properties: {
[propName: string]: any;
};
references: {
[referenceName: string]: any;
};
isFullyLoaded: boolean;
uri: string;
parent: NodeContextPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ export default class InspectorEditorEnvelope extends PureComponent {
//
// nodeType needs to be read directly from node
//
const sourceValueRaw = id === '_nodeType' ? node?.nodeType : node?.properties?.[id];
const sourceValue = sourceValueRaw;
const sourceValue = id === '_nodeType' ? node?.nodeType : (node?.references?.[id] ? node?.references?.[id] : node?.properties?.[id]);
const transientValue = transientValueRaw;

return (
Expand Down

0 comments on commit d0ed939

Please sign in to comment.