Factor in substitution type when building paths for suggested media items

Created on 28 August 2023, over 1 year ago
Updated 8 November 2023, about 1 year ago

Problem/Motivation

Media items without a standalone URL enabled do not display the correct item in the url field once it has been selected and saved. The canonical url for media items without a standalone url have '/edit' on the end. When we trim it before building the path, it does not display the correct item as a suggestion when clicking on the field again.

Steps to reproduce

1. Disable the standalone media setting in the Media config.
2. Search for a Media item (e.g. an Image) using a Linkit field.
3. Select the media item. The path should display in the field e.g. /media/1.
4. Click on the field again, no results are displayed.
5. Save the node, and edit it again. The path displayed in the field is /media/1/edit and the suggestion for the node is correct.

Proposed resolution

When building the url path in the EntityMatcher, take into account the substitution type selected to generate the correct url instead of trimming /edit from the end of the url.

In the LinkitWidget to populate the default value of the field, check the substitution type for the media item and generate the url path accordingly.

Feature request
Status

Needs review

Version

6.1

Component

Code

Created by

🇬🇧United Kingdom minirobot London

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

Comments & Activities

Production build 0.71.5 2024