[SOLVED] Node label with custom EEL helper

Hi there,

I’m a little bit sorry for this (easy?) question. But I don’t get it. Where are the limitations of using an EEL helper inside a nodes label field?

I’ve a node which contains two references and has no own title (Relation “Actor - Role”). In the tree I want to show the actor’s name, or the role. Or both. So I created an own EEL helper which returns the title of a reference. So far, so easy.

This works (with a given EEL helper from the NEOS reference):

‘My.Site:Component.ActorRole’:
label: “${String.firstLetterToUpperCase(‘hello world’)}”

This does not work (a custom EEL helper):

‘My.Site:Component.ActorRole’:
label: “${My.Site.CustomEelHelper.getValue( q(node).property(‘role’) , ‘title’)}”

My only explanation for this is, that my own Package (with my custom eel helper within) loads too late maybe inside the composer.json. And can’t effect the nodes label.

I also saw there are some more functions since NEOS 7.1 for better label-using. But they don’t seems to help me here: https://www.neos.io/blog/neos-flow-71-released.html

Does anyone have an explanation for me?

Kind regards,

Maximilian

The Labels are generated by this class: https://github.com/neos/neos-development-collection/blob/master/Neos.ContentRepository/Classes/Domain/Model/ExpressionBasedNodeLabelGenerator.php

Which gets the defaultContext (available helpers) from the setting
Neos.ContentRepository.labelGenerator.eel.defaultContext and is configured here

By adding your helper here to this setting you should be fine.

Regards, Martin

1 Like

Great, works right away. Thank you very much :slight_smile: