Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: NodeUriPathSegmentGenerator generates a different result if node label is configured #4836

Open
1 task done
lorenzulrich opened this issue Jan 15, 2024 · 0 comments
Open
1 task done
Labels

Comments

@lorenzulrich
Copy link
Contributor

lorenzulrich commented Jan 15, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The NodeUriPathSegmentGenerator generates a different output when creating a node and refreshing the uriPathSegment if a node label is configured.

The linked code shows the problem:

$text = $text ?: $node->getLabel() ?: $node->getName();

When a uriPathSegment is refreshed from the Neos UI, the $text property is passed along and respected, but the node configuration is not evaluated.

When a uriPathSegment is generated on creating a page, the node label is used. The node label defaults to the title, but can be overridden in the node type configuration.

Expected Behavior

If a node label is configured, either

  • the node label is not respected also when refreshing the uriPathSegment

or

  • the node label is never respected (which would be breaking)

(Personally, I've always felt that the node label configuration is a backend thing - to be able to improve readability in the node tree. But it is also used by default in the Menu implementations.)

Steps To Reproduce

  1. Create a document node type with a node label configuration:
'My.Site:Document.EventPage':
  label: "${q(node).property('date') ? Date.format(q(node).property('date'), 'd.m.Y') + ': ' + q(node).property('title') : q(node).property('title')}"
  superTypes:
    'Neos.Neos:Document': true
  ui:
    inspector:
      tabs:
        newsEvent:
          label: Veranstaltung
          icon: 'icon-ticket'
          position: 10
      groups:
        eventDates:
          label: Veranstaltungsdaten
          position: 10
          icon: 'icon-calendar-empty'
          tab: newsEvent
  properties:
    date:
      type: DateTime
      ui:
        reloadIfChanged: true
        showInCreationDialog: true
        label: Von Datum/Zeit
        inspector:
          group: eventDates
          position: 50
          editorOptions:
            format: 'd.m.Y H:i'
            minuteStep: 5
            placeholder: ''
      validation:
        'Neos.Neos/Validation/NotEmptyValidator': []
  1. Create such a node. Since you have to select a date, the resulting uriPathSegment will be something like 15-01-2024-the-given-title (which is not great but there's nothing you can do about it - also see here).

  2. Refresh the uriPathSegment in the Neos UI. The uriPathSegment will change to the-given-title.

Environment

- Neos: 8.3 (but must be present in lower versions, too)

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant