Skip to content

Commit

Permalink
Merge pull request #5216 from kitsunet/bugfix/service-templates-refer…
Browse files Browse the repository at this point in the history
…ence-nodes

BUGFIX: Adjust service templates for references
  • Loading branch information
nezaniel authored Aug 21, 2024
2 parents a9261f4 + 1425bcf commit a0959d4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
30 changes: 30 additions & 0 deletions Neos.Neos/Classes/ViewHelpers/Node/LabelViewHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Neos\Neos\ViewHelpers\Node;

use Neos\ContentRepository\Core\Projection\ContentGraph\Node;
use Neos\Flow\Annotations as Flow;
use Neos\FluidAdaptor\Core\ViewHelper\AbstractViewHelper;
use Neos\Neos\Domain\NodeLabel\NodeLabelGeneratorInterface;

/**
* Viewhelper to render a label for a given Node
*/
class LabelViewHelper extends AbstractViewHelper
{
#[Flow\Inject()]
protected NodeLabelGeneratorInterface $nodeLabelGenerator;

public function initializeArguments(): void
{
parent::initializeArguments();
$this->registerArgument('node', Node::class, 'Node', true);
}

public function render(): string
{
/** @var Node $node */
$node = $this->arguments['node'];
return $this->nodeLabelGenerator->getLabel($node);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1>{neos:backend.translate(id: 'service.nodes.title', value: 'Nodes')}</h1>
</f:else>
</f:if>
</f:alias>
<label class="node-label">{node.label}</label>
<label class="node-label">{neos:node.label(node: node)}</label>
(<span class="node-identifier">{node.aggregateId.value}</span>)
[<span class="node-type">{node.nodeTypeName.value}</span>]
<f:link.action rel="node-show" controller="Service\Nodes" action="show" arguments="{identifier: node.aggregateId.value}" format="html">{neos:backend.translate(id: 'service.nodes.show', value: 'Show')}</f:link.action>
Expand All @@ -35,4 +35,5 @@ <h1>{neos:backend.translate(id: 'service.nodes.title', value: 'Nodes')}</h1>
</div>
</body>
</html>
<f:section name="breadcrumb"><f:if condition="{node.parent} && {node.parent.depth} > 1"><f:render section="breadcrumb" arguments="{node: node.parent}" /> &gt; </f:if>{node.label}</f:section>
<f:section name="breadcrumb"><f:if condition="{node.parent} && {node.parent.depth} > 1"><f:render section="breadcrumb" arguments="{node: node.parent}" /> &gt; </f:if>{neos:node.label(node: node)}</f:section>

8 changes: 4 additions & 4 deletions Neos.Neos/Resources/Private/Templates/Service/Nodes/Show.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{namespace neos=Neos\Neos\ViewHelpers}
<html>
<head>
<title>{neos:backend.translate(id: 'node', value: 'Node')}: {node.label}</title>
<title>{neos:backend.translate(id: 'node', value: 'Node')}: {neos:node.label(node: node)}</title>
<meta charset="UTF-8"/>
</head>
<body>
<div>
<h1>{neos:backend.translate(id: 'node', value: 'Node')}: {node.label}</h1>
<h1>{neos:backend.translate(id: 'node', value: 'Node')}: {neos:node.label(node: node)}</h1>
<div class="node">
<label class="node-label">{node.label}</label>
<label class="node-label">{neos:node.label(node: node)}</label>
<table class="node-properties">
<caption>{neos:backend.translate(id: 'service.nodes.nodeProperties', value: 'Node Properties')}</caption>
<tr>
Expand All @@ -17,7 +17,7 @@ <h1>{neos:backend.translate(id: 'node', value: 'Node')}: {node.label}</h1>
</tr>
<tr>
<th>_path</th>
<td class="node-path">{node.path}</td>
<td class="node-path">{node.name}</td>
</tr>
<tr>
<th>nodeContextPath</th>
Expand Down

0 comments on commit a0959d4

Please sign in to comment.