Invalid token "The user-entered string '' must begin with a '/', '?', or '#'."

Created on 22 November 2022, about 2 years ago
Updated 3 October 2023, about 1 year ago

Problem/Motivation

When a token does NOT exist, then `Url::fromUserInput` tries to generate the URL by using the token, it throws:

The user-entered string '' must begin with a '/', '?', or '#'.

Steps to reproduce

Add a token that does NOT apply, for example, a node without parent-parent within the menu system:
[node:menu-link:parent:parent:url]

Proposed resolution

Add an extra parameter to the token manager in order to clear the text when a token replacement is NOT found.
['clear' => TRUE] then we can confirm the Url is NOT empty before using the `Url::fromUserInput` method.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇷Costa Rica keboca

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024