[5.x] Exclude sites without sources from the site menu in element selector modals #15091
-
It'd be great if the site menu in element selector modals excluded sites without any sources. In multi-site installs, it's not uncommon to have certain sections that are only enabled for some of the sites - and to create entries fields that have the "Show the site menu" setting enabled, in order to enable authors to select entries from those sections, even from elements in sites without those sections enabled. In those cases, the element selector modal will often be completely empty when it opens, if opened via a relational field in a site where the configured sources aren't enabled. At that point, the author needs to remember which site(s) they can find the content they're looking for, and to switch the site menu to the correct site. In multi-sites with many sites, this makes for a frustrating AX - especially for installs with a lot of sites. From the author's perspective, it's difficult to understand, and potentially frustrating, how and why the modal site menu always lists all the sites, instead of just including the ones that are relevant (i.e. that have sources), in any particular selector modal. Sometimes, the "Relate entries from a specific site?" can be used to work around this, but not always – for example, in cases where the entries field must be configured to select from multiple sources that are enabled for different sites, or if the entries aren't propagated between sites for the sources the field is configured to select entries from. Regardless of the use case, and considering the fact that it's arguably pointless to be able to "select" elements from sites without any enabled sources, I think it would make a lot of sense to simply exclude any and all sites without any enabled sources from the element selector modal site menu – similarly to how the site menu in element edit pages doesn't include sites in which the element being edited doesn't exist. If this change happens, one inevitable side effect is that it's no longer guaranteed that the requested site (i.e. the site for the element that owns the relational field triggering the selector modal) is going to be available in the site menu, which means that the selector modal site menu can't have the requested site selected as the active site when the modal opens. In such cases, I think it'd be OK if the element selector modal fell back on simply having the first site in the site menu as the initially selected site. Or, perhaps the site menu could fall back to selecting the first available site using the same language as the requested site (and finally falling back to the first available site, if there are no sites available using the same language), which would work well for multi-lingual sites in cases where certain sections are only available to some of the sites. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Good call. Just made this change for Craft 5.2 (e8dfa7d). |
Beta Was this translation helpful? Give feedback.
Good call. Just made this change for Craft 5.2 (e8dfa7d).