Add option to output URL base fields in views as absolute

Created on 22 May 2023, over 1 year ago
Updated 12 June 2023, over 1 year ago

Problem/Motivation

Currently there is no option to output URL fields in views as absolute.

Steps to reproduce

1. Add a URL field to a view
2. There is no option to show a URL in absolute form (opposed to outputting absolute URLs in custom links which is just the href).

Proposed resolution

Include an 'Output absolute URL' option in Drupal\views\Plugin\views\field\Url. Conditionally output an absolute URL when render() is called based on this new option.

Remaining tasks

Write a patch
Tests
Review
Commit

User interface changes

A new option will appear below the current 'Display as link' option.

API changes

None.

Data model changes

None.

Release notes snippet

TBD

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 7 hours ago

Created by

πŸ‡¦πŸ‡ΊAustralia mcaddz

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.

  • Issue created by @mcaddz
  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Just adding to this, the motivation for this feature depends on ✨ Expose URL alias fields to views Needs work . We are generating a CSV of path aliases and would to see the absolute URL in the output.

  • Assigned to isalmanhaider
  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    Adding it to that handler would make this only available in base fields. Since most fields would be fields added through the UI, shouldn't the option be there? Or in both?

    We have the option on the EntityLink handler, so trying for some feature parity might not be bad. But I'm always weary of adding more checkobxes to the already way too full Views UI

  • πŸ‡¦πŸ‡ΊAustralia mstrelan

    Adding it to that handler would make this only available in base fields. Since most fields would be fields added through the UI, shouldn't the option be there? Or in both?

    The use case we're currently looking for is for base fields on path alias entities. Link fields added through the UI, as opposed to URL base fields, use the "field" plugin (\Drupal\views\Plugin\views\field\EntityField) to render a field using a formatter. We would need to add this option to the formatter rather than the views field plugin. I think we can limit the scope of this issue to just URL base fields.

    We have the option on the EntityLink handler, so trying for some feature parity might not be bad. But I'm always weary of adding more checkobxes to the already way too full Views UI

    I looked at this first, but not sure it lends itself well to reuse.

  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    Ok, matched the title to the proposed scope

Production build 0.71.5 2024