[meta] Undocumented "internal://" in Url::fromUri.

Created on 27 April 2016, over 9 years ago
Updated 31 July 2025, 6 days ago

Problem/Motivation

Currently it's possible to use "special" path like internal:// as valid uri to Drupal\Core\Url::fromUri(), this is partially documented with the phrase "For user input that may correspond to a Drupal route, use internal: for the scheme.".
However it's also possible to use other special paths like <current> and <none>, and this is not documented in the fromUri page, of course digging even more the path is documented in fromInternalUri, however the is still missing and event the .
I believe all those "hidden" special paths should be well documented and listed somewhere.

Initial discussion from irc://#drupal-contribute:

esolitos: I have a quick one (as usual), if I need to create a  `Url` class which contains _only_ the fragment? It doesn’t seems it’s possible using Drupal\Core\Url, is it?
dawehner: esolitos: <fragment> with option fragment should do it
dawehner: esolitos: <none>
esolitos: dawehner: Thanks, the fragment option i knew about, but I didn't know <none> was a valid url 
dawehner: esolitos: yeah there is some magic involved
esolitos: It’s not documented, is it?
dawehner: esolitos: nope, do you mind creating an issue for that? Same with <current>

Proposed resolution

The fastest solution would be just to add the documentation for internal://<current> and internal://<none>, but I believe it would be better to either have a dedicated public methods to wrap around this behaviours (for example Url::fromCurrentUri($options) and Url::fromEmptyUri($options)) or having some constants in the class like Url::EMPTY_URI and Url:CURRENT_URI.

Remaining tasks

TBD

User interface changes

N/A

API changes

New methods or new constants in Drupal\Core\Url.

Data model changes

N/A

📌 Task
Status

Postponed: needs info

Version

11.0 🔥

Component

other

Created by

🇳🇴Norway esolitos Trondheim

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

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.

  • 🇺🇸United States smustgrave

    Thank you for creating this issue to improve Drupal.

    We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024