Add a generic trait for logic to convert references into Urls in LinkWidget

Created on 29 May 2024, 7 months ago
Updated 14 June 2024, 6 months ago

Problem/Motivation

LinkWidget provides a creative logic for internal links that converts the autocomplete entity value into their equivalent URI and vice-versa along its lifecycle.

That logic is pretty neat and could be interesting to move it to a generic trait in order to be reused by other parts of core or contrib modules that might require this logic.

A good scenario to use this trait and avoid copy&paste code is in https://www.drupal.org/project/drupal/issues/3445993 πŸ“Œ Provide a NavigationLinkBlock Plugin and use Help as an usage example Needs review , where Navigation links might use this logic

Proposed resolution

Move the following methods to a generic trait and implement and use the trait in LinkWidget:

  • LinkWidget::validateUriElement()
  • LinkWidget::getUriAsDisplayableString()
  • LinkWidget::getUserEnteredStringAsUri()

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Active

Version

11.0 πŸ”₯

Component
LinkΒ  β†’

Last updated 3 days ago

Created by

πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024