Closed mhsdesign closed 1 week ago
As discussed in here
10.) Idk why node label generation is THE most complex thing and it should rather be a Neos concern? It will be tricky to crack that nut while keeping everything lazy. But i dont think that the
NodeLabelGeneratorInterface
should be constructed with theNodeType
and have theNode
passed on the actual call. That seems like duplicate information.I'm not sure what you mean. You wonder why it should be a Neos concern or you suggest to make it a Neos concern? I think the latter, right? And my gut feeling is the same.
$node->getLabel()
would have to be replaced with s.th. like
$nodeLabelRenderer->renderNodeLabel($node);
which would do sth like
$nodeTypeManager->getNodeType($node->nodeTypeName)->metadata['label.generatorClass'] ?? ...
Perfect. For node label generation we introduce a standalone Neos' singleton NodeLabelRenderer
which serves as factory for the registered label.generatorClass
(the actual extendable NodeLabelGeneratorInterface
) and will just require the $node
as argument:
For Fusion we can create a migration that rewrites node.label
to the (new) helper method Neos.Node.label(node)
and we are lucky that Node::getLabel
is not actually used in the ESCR core itself but only in Neos and Ui, which will be fairly easy to adapt.
Node::getLabel is not actually used in the ESCR core itself but only in Neos and Ui, which will be fairly easy to adapt.
In the core we could easily fix it anyways. The real issue is, that it is used out in the wild. But with rector we should be able to fix fusion and PHP usages hopefully
With https://github.com/neos/neos-development-collection/pull/4466 the fallback nodetype handling was removed from the core nodetype provider and extracted to neos. (inside a trait
NodeTypeWithFallbackProvider
) That required to make thenodeType
field nullable on the NodeType and we also deprecated it.Staying in this intermediate step for longer has the following downsides:
Node::nodeType
even if its discouraged which will lead to possibly buggy code.Node::getNodeType
toNode::nodeType
i could very well imagine to adjust this migration to use the nodeType manager: https://github.com/neos/rector/blob/4843c45f5bd901bd63aad0d1d0367df394e2cd1e/config/set/contentrepository-90.php#L145Same / similar points phrased slightly different from @bwaidelich in slack: