- Issue created by @bogdan.dinu
- 🇷🇴Romania bogdan.dinu
Updated patch that clears the query and fragment for non reference links.
Linkit Widget for link fields is not preserving the query and fragment (anchor) of the input url.
There is a similar issue raised on the linkit issue board (
https://www.drupal.org/project/linkit/issues/3223919
✨
Preserve query parameters and fragments when directly inputting a path.
RTBC
) for which I submitted a patch to make it work with the current one.
The initial solution proposed on that issue is adding the query and fragment in the uri, which I consider is not a correct way to do it because it is not using the code link schema and it breaks compatibility with the core link widget or other plugins that support the core link schema.
The core link schema includes an options map that is used to store the query and the fragment.
- enable the linkit field widget for a link field
- paste an internal url that includes query and fragment
- save the entity
- the generated link for that field is missing the query and fragment parts
- add separate hidden fields for query and fragment in the LinkitWidget that are updated by the autocomplete suggestions js (part of the patch in the issue I posted on the linkit issue board)
- save the fields in the options base field of the link field
- make the distinction between the uri that is saved in the database (which should have the query and fragment) and the uri_as_url which is shown in the input field and should show the query and fragment) <-- this is the reason I didn't submit the patch on the LinkitWidget from the linkit module
- integrate the changes in the LinkitWidget in the linkit module
Active
1.0
Code
Updated patch that clears the query and fragment for non reference links.