Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When browsing for possible content to pull down across sites, there's no way for users to actually see the content they're pulling down, other than to separately navigate to that site, and then attempt to find that piece of content. Likewise, once a piece of content is pulled down, there's no direct link between the Pull form and the actual piece of content on the site.
To improve this, links to the remote and local copies of the content would be helpful.
Current UI:
Proposed UI adding links to remote and local copies:
Comment | File | Size | Author |
---|---|---|---|
#6 | entity_share-link_to_remote_and_local-3077810-6.patch | 15.26 KB | Grimreaper |
Screenshot from 2019-08-28 15-57-59.png | 29.57 KB | quicksketch | |
Screenshot from 2019-08-28 15-52-45.png | 23.04 KB | quicksketch |
Comments
Comment #2
quicksketchOops I got the links backward in my screenshot when I mocked that up. The "(view local)" link should appear if you have a local copy of course. It would not display for new entities not yet pulled down.
There is a caveat here in that it's possible to pull down unpublished content or content you don't even access to on the other site. However, even linking to where the content would be is better than no link at all.
Comment #3
GrimreaperHello,
@quicksketch thanks for the suggestion!
Agreed, and no problem for the caveat.
Comment #4
GrimreaperI think for the local link it will be easy but for the remote one...
In JsonapiHelper::addOptionFromJson()
$data["attributes"]["drupal_internal__nid"]
contains the entity id.So it will be possible to make a link to the remote website:
Comment #5
GrimreaperComment #6
GrimreaperAnd here is a patch.
It also changes some "JSON API" strings into "JSON:API".
I will need to create a dedicated service for the display of the pull form and stop to complexify JsonApiHelper.
Comment #8
GrimreaperComment #9
quicksketchLooking great, thanks @Grimreaper! I'll try this out on our project this week!
Comment #10
quicksketchHi @Grimreaper, I tried this out and it works, but it seems there's an extra slash in the remote URL. Here's the markup I'm seeing:
Are you seeing this as well?
Comment #11
GrimreaperHi @quicksketch,
Thanks for testing.
I am seeing an extra slash if on the remote website's url there is a trailing slash.
If there is no trailing slash, there is no extra slash.
Is it ok for you or should I change the code a little bit to avoid this case?
Comment #12
quicksketchAh! I see. Maybe in that case we should make a separate issue just to ensure the formatting of the remote URL is consistent? Either throw a validation error or (preferably) just add or remove the trailing slash to the preferred format. For our purposes, I can just fix the value saved in the configuration.
Comment #13
quicksketchFollow-up issue created at #3087251: Remove (or add) trailing slash on remote URLs for consistency.
Comment #14
GrimreaperThanks for the follow up issue :)