Add option to Url() to force the site base_url to be used

Created on 8 August 2015, about 10 years ago
Updated 2 September 2025, 15 days ago

Problem/Motivation

There are a few situations in core where links are generated when the system is running outside of the primary front controller or from a special route. These include

  • update.php
  • core/authorize.php
  • core/rebuild.php
  • core/install.php (?)

When links are generated, there are two scenarios. One, a link needs to be generated relative to the entry point (eg, update.php). Two, a link needs to be generated relative to the site root. When this happens, the base_url gets passed into Url() as an option, but to get the base_url you either need to rely on the global or perform some shenanigans to construct it on your own. This is bad.

Proposed resolution

Options for discussion:

Remaining tasks

Discuss, do it.

User interface changes

None.

API changes

Url() and/or the link generator may have a new option.

Data model changes

Should be none.

πŸ“Œ Task
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

routing system

Created by

πŸ‡ΊπŸ‡ΈUnited States mpdonadio Philadelphia/PA/USA (UTC-5)

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!

  • πŸ‡¨πŸ‡¦Canada joelpittet Vancouver

    All the @todos this removes are still there. Also my question (and joke) in #27 still stands.

    Needs to moved to MR

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Leaving tag for stats

Production build 0.71.5 2024