presseddigital / linkit

Linkit Plugin for Craft 4
Other
28 stars 18 forks source link

Allow to select entries from other sites in entry picker not working #84

Open theresao opened 3 years ago

theresao commented 3 years ago

Follow up ticket to https://github.com/presseddigital/linkit/issues/72

After the fix from issue 72 I now have a dropdown with my multisites in the linkit entry picker. When i select an other site in this dropdown, the select options (entries to choose from) do not change. So unfortunately it is still not possible to select entries from other multisites.

It would be great if you could check that again, thank you!

fvaldes33 commented 3 years ago

We are seeing the same issues. Below is the payload from the modal when I switch sites. Should be showing siteId 3.

{
    "context": "modal",
    "elementType": "craft\\elements\\Entry",
    "source": "*",
    "criteria": {
        "siteId": 1,
        "search": null,
        "offset": 0,
        "limit": 100,
        "status": null,
        "enabledForSite": null
    },
    "disabledElementIds": [35119],
    "viewState": {
        "mode": "table",
        "order": "postDate",
        "sort": "desc"
    },
    "paginated": 0
}

Looks like this pull request did not get merged in? 81

In that PR I see the removal of the siteId siteId: element.siteId ?? null, but still see it in 1.1.12.1

ghost commented 3 years ago

Well, #72 fixed the dialog part. But our dev's also hit this roadblock; after saving the element just disappears.

fruitstudios\linkit\base\ElementLink.php:85 asks for the owner element siteId. Removing this will show the selected cross-site item.

However, the link model doesn't store the selected element's siteId. So linking to it is still not possible. Besides that, there is the consideration how the translation method should play in this.

Any thoughts on this @ben-callaway? Or is this out of scope as far as you are concerned?

fvaldes33 commented 3 years ago

@renzo-s - We ran into the same thing. Ended up just using aliases inside regular URL links for now.

I can give it a shot if this ends up being out of scope for @ben-callaway. We have 4-5 different multisite installs all using this plugin.

ghost commented 3 years ago

Okay.. I hacked it in. Mostly used the non-modern JS style of the rest of the package. I'll create a pull if everything tested well.

What I did was create a hidden field, as an extra param in the field. Added it to the base model of Link and created some JS to listen for element select changes. This assumes only one entry selection, which is not technically true for the element select field, but is for the LinkIt field.

Edit: Code change overview is silly now it's in my fork

I'm not a plugin author and going through this with the lack of documentation from Craft and Garnish is a real pain. Massive props for the original author and other plugin creators.

fvaldes33 commented 3 years ago

@renzo-s - Thanks for this! I can pull your fork into one of my multisite projects to test. Prob later today. Keep you posted.

ghost commented 3 years ago

Any notes on trying out the fork @fvaldes33? I created the pull request anyway. Seems good on this end.

abryrath commented 3 years ago

@renzo-s I am working with @fvaldes33 and I'm hoping to test this fork this morning. Will update soon

abryrath commented 3 years ago

@renzo-s I tested your fork and it is working for me on a multisite install

ghost commented 3 years ago

Thats great news. Can you merge and release this once you give it the one over @ben-callaway?

davidhellmann commented 3 years ago

🤔 any updates here?

belkin commented 3 years ago

We're having the same issue with multisite setup. After selecting entry from another site group and saving it, page refreshes but the field is empty. With working forks and PR can we get any info/update over this?

iuscare commented 3 years ago

We're having the same issues with multisites. Any updates, if the PR will be implemented?

ThomasRitter75 commented 2 years ago

There is no movement in this since 2020. Will this at least be fixed in the Craft 4 version?

JayBox325 commented 2 years ago

Just noticed that entries are un-selected when I am looking at an entry that is shared across multiple sites. I'd hope this would be fixed in CraftCMS3

FrDH commented 2 years ago

+1

mnlmaier commented 1 year ago

Hey @ben-callaway, any updates on this? :)