Skip to content

Commit

Permalink
TASK: Adjust fusion code to use Neos.Node.getNodeType
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed May 15, 2024
1 parent 3b6e417 commit a2f9300
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ExpressionBasedNodeLabelGenerator implements NodeLabelGeneratorInterface
* @var string
*/
protected $expression = <<<'EEL'
${(node.nodeType.label ? node.nodeType.label : node.nodeTypeName.value) + (node.nodeName ? ' (' + node.nodeName.value + ')' : '')}
${(Neos.Node.getNodeType(node).label || node.nodeTypeName.value) + (node.nodeName ? ' (' + node.nodeName.value + ')' : '')}
EEL;

/**
Expand All @@ -64,7 +64,6 @@ public function getLabel(Node $node): string
if (Utility::parseEelExpression($this->getExpression()) === null) {
return $this->getExpression();
}
$value = Utility::evaluateEelExpression($this->getExpression(), $this->eelEvaluator, ['node' => $node], $this->defaultContextConfiguration);
return (string)$value;
return (string)Utility::evaluateEelExpression($this->getExpression(), $this->eelEvaluator, ['node' => $node], $this->defaultContextConfiguration);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prototype(Neos.Neos:RawContent.NodeHeader) < prototype(Neos.Fusion:Component) {

labelParts = ${String.split(node.nodeType.label, ':')}
icon = ${node.nodeType.fullConfiguration.ui.icon}
labelParts = ${String.split(Neos.Node.getNodeType(node).label, ':')}
icon = ${Neos.Node.getNodeType(node).fullConfiguration.ui.icon}
visibilityInformations = Neos.Fusion:DataStructure {
hidden = 'hidden'
hidden.@if.isHidden = ${node.hidden}
Expand All @@ -11,7 +11,7 @@ prototype(Neos.Neos:RawContent.NodeHeader) < prototype(Neos.Fusion:Component) {
renderer = afx`
<header>
<i class={'fas fa-' + props.icon + ' ' + props.icon} @if={props.icon}></i>&nbsp;
{(node.tethered || q(node).is('[instanceof Neos.Neos:Document]')) ? q(node).label() : Translation.translate(props.labelParts[2], node.nodeType.label, [], props.labelParts[1], props.labelParts[0])}
{(node.classification.tethered || q(node).is('[instanceof Neos.Neos:Document]')) ? q(node).label() : Translation.translate(props.labelParts[2], Neos.Node.getNodeType(node).label, [], props.labelParts[1], props.labelParts[0])}
<span @if={props.visibilityInformations}> - {props.visibilityInformations}</span>
</header>
`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
prototype(Neos.Neos:RawContent.NodeProperties) < prototype(Neos.Fusion:Component) {
@private {
items = ${node.nodeType.properties}
items = ${Neos.Node.getNodeType(node).properties}
items.@process.sort = ${Neos.Array.sortByPropertyPath(value, 'ui.inspector.position')}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Feature: Tests for the "Neos.Neos:ContentCollection" Fusion prototype
include: resource://Neos.Neos/Private/Fusion/Root.fusion
prototype(Neos.Neos:Test.ContentType) < prototype(Neos.Fusion:Value) {
value = ${node.nodeAggregateId.value + ' (' + node.nodeType.name.value + ') '}
value = ${node.nodeAggregateId.value + ' (' + node.nodeTypeName.value + ') '}
}
test = Neos.Neos:ContentCollection {
Expand Down
28 changes: 12 additions & 16 deletions Neos.Neos/Tests/Unit/Fusion/Helper/CachingHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,23 @@
* source code.
*/

use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint;
use Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint;
use Neos\ContentRepository\Core\Feature\NodeModification\Dto\SerializedPropertyValues;
use Neos\ContentRepository\Core\Infrastructure\Property\PropertyConverter;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\ContentRepository\Core\Projection\ContentGraph\NodeTags;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAddress;
use Neos\ContentRepository\Core\Projection\ContentGraph\PropertyCollection;
use Neos\ContentRepository\Core\Projection\ContentGraph\Timestamps;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\ContentRepository\Domain\Model\Workspace;
use Neos\ContentRepository\Domain\Service\Context;
use Neos\Flow\Tests\UnitTestCase;
use Neos\Neos\Fusion\Helper\CachingHelper;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\Projection\ContentGraph\ContentSubgraphIdentity;
use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId;
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint;
use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\DimensionSpace\OriginDimensionSpacePoint;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateClassification;
use Neos\ContentRepository\Core\Projection\ContentGraph\Timestamps;
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
use Neos\ContentRepository\Core\Projection\ContentGraph\PropertyCollection;
use Neos\ContentRepository\Core\Feature\NodeModification\Dto\SerializedPropertyValues;
use Neos\ContentRepository\Core\Infrastructure\Property\PropertyConverter;
use Symfony\Component\Serializer\Serializer;

/**
Expand Down

0 comments on commit a2f9300

Please sign in to comment.