Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Classes/Eel/Helper/LinkedDataHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ final class LinkedDataHelper implements ProtectedContextAwareInterface
* @var EelEvaluatorInterface
*/
protected $eelEvaluator;
#[\Neos\Flow\Annotations\Inject]
protected \Neos\ContentRepositoryRegistry\ContentRepositoryRegistry $contentRepositoryRegistry;

public function render(NodeInterface $node, $preset = 'default'): string
public function render(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node, $preset = 'default'): string
{
return $this->wrap(
$this->item($node, $preset)
Expand All @@ -43,7 +45,7 @@ public function renderRaw(array $data): string

public function list(array $collection, $preset = 'default', bool $withContext = true): array
{
$data = array_map(function (NodeInterface $node) use ($preset, $withContext) {
$data = array_map(function (\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node) use ($preset, $withContext) {
return $this->item($node, $preset, $withContext);
}, $collection);

Expand All @@ -60,12 +62,13 @@ public function list(array $collection, $preset = 'default', bool $withContext =
return $data;
}

public function item(NodeInterface $node, $preset = 'default', bool $withContext = true): array
public function item(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node, $preset = 'default', bool $withContext = true): array
{
$configuration = $this->getConfiguration($node, $preset);
$fragment = $configuration['fragment'];
if ($configuration === null) {
throw new Exception(sprintf('Missing options.TtreeLinkedData:Generator configuration for the current node type (%s)', $node->getNodeType()), 1497984924);
$contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId);
throw new Exception(sprintf('Missing options.TtreeLinkedData:Generator configuration for the current node type (%s)', $contentRepository->getNodeTypeManager()->getNodeType($node->nodeTypeName)->name), 1497984924);
}

$contextVariables = $this->prepareContextVariables($configuration, $node, $preset);
Expand All @@ -84,7 +87,7 @@ public function item(NodeInterface $node, $preset = 'default', bool $withContext
return $fragment;
}

protected function prepareContextVariables(array $configuration, NodeInterface $node, string $preset)
protected function prepareContextVariables(array $configuration, \Neos\ContentRepository\Core\Projection\ContentGraph\Node $node, string $preset)
{
$contextVariables = [
'node' => $node,
Expand Down Expand Up @@ -115,9 +118,10 @@ protected function cleanup(array &$array)
}
}

protected function getConfiguration(NodeInterface $node, $preset = 'default')
protected function getConfiguration(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node, $preset = 'default')
{
return $node->getNodeType()->getConfiguration($this->configurationPath . '.' . $preset);
$contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId);
return $contentRepository->getNodeTypeManager()->getNodeType($node->nodeTypeName)->getConfiguration($this->configurationPath . '.' . $preset);
}

protected function isEelExpression(string $expression)
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Neos:
Ttree.LinkedData: true
Fusion:
defaultContext:
LinkedData: 'Ttree\LinkedData\Eel\Helper\LinkedDataHelper'
LinkedData: Ttree\LinkedData\Eel\Helper\LinkedDataHelper
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "neos-package",
"license": "MIT",
"require": {
"neos/neos": ">=7.0"
"neos/neos": "^9.0"
},
"autoload": {
"psr-4": {
Expand Down