From 5362768ab43b920b00dd296b74aaffaa59e8f833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Mu=CC=88ller?= Date: Tue, 20 Aug 2024 20:13:27 +0200 Subject: [PATCH 1/2] BUGFIX: Adjust service templates for references These templates are used e.g. in the reference editor, we should create a better endpoint in the UI package, but for now this will fix setting references and provides Fluid users with a viewhelper to render node labels. --- .../ViewHelpers/Node/LabelViewHelper.php | 29 +++++++++++++++++++ .../Templates/Service/Nodes/Index.html | 5 ++-- .../Private/Templates/Service/Nodes/Show.html | 8 ++--- 3 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php diff --git a/Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php new file mode 100644 index 00000000000..ad79b7012fb --- /dev/null +++ b/Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php @@ -0,0 +1,29 @@ +registerArgument('node', Node::class, 'Node', true); + } + + public function render(): string + { + /** @var Node $node */ + $node = $this->arguments['node']; + return $this->nodeLabelGenerator->getLabel($node); + } +} diff --git a/Neos.Neos/Resources/Private/Templates/Service/Nodes/Index.html b/Neos.Neos/Resources/Private/Templates/Service/Nodes/Index.html index 04380e2fb73..d9a6bca19f5 100644 --- a/Neos.Neos/Resources/Private/Templates/Service/Nodes/Index.html +++ b/Neos.Neos/Resources/Private/Templates/Service/Nodes/Index.html @@ -25,7 +25,7 @@

{neos:backend.translate(id: 'service.nodes.title', value: 'Nodes')}

- + ({node.aggregateId.value}) [{node.nodeTypeName.value}] {neos:backend.translate(id: 'service.nodes.show', value: 'Show')} @@ -35,4 +35,5 @@

{neos:backend.translate(id: 'service.nodes.title', value: 'Nodes')}

- > {node.label} + > {neos:node.label(node: node)} + diff --git a/Neos.Neos/Resources/Private/Templates/Service/Nodes/Show.html b/Neos.Neos/Resources/Private/Templates/Service/Nodes/Show.html index 0d3490174c1..c1ec0fd07bc 100644 --- a/Neos.Neos/Resources/Private/Templates/Service/Nodes/Show.html +++ b/Neos.Neos/Resources/Private/Templates/Service/Nodes/Show.html @@ -1,14 +1,14 @@ {namespace neos=Neos\Neos\ViewHelpers} - {neos:backend.translate(id: 'node', value: 'Node')}: {node.label} + {neos:backend.translate(id: 'node', value: 'Node')}: {neos:node.label(node: node)}
-

{neos:backend.translate(id: 'node', value: 'Node')}: {node.label}

+

{neos:backend.translate(id: 'node', value: 'Node')}: {neos:node.label(node: node)}

- + @@ -17,7 +17,7 @@

{neos:backend.translate(id: 'node', value: 'Node')}: {node.label}

- + From 1425bcf0594d8376428c026b68692a82cd9f45f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Mu=CC=88ller?= Date: Tue, 20 Aug 2024 20:29:48 +0200 Subject: [PATCH 2/2] Be nice to the linter --- Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php b/Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php index ad79b7012fb..b3bbb0edfc4 100644 --- a/Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php +++ b/Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php @@ -1,4 +1,5 @@
{neos:backend.translate(id: 'service.nodes.nodeProperties', value: 'Node Properties')}
_path{node.path}{node.name}
nodeContextPath