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.
This suggestion came in from our end-users. On our project, we currently have only 2 sites. Each site only has one channel. And the two sites cross-share content between them (so only one remote per site). When visiting the content pull form, they have 2 select lists, each with only a single value in them. The suggestion made is that:
- When on the Entity Sync pull form, if only one site is available, that option is pre-selected.
- On the same form, if only one channel is available from the selected site, that option is pre-selected.
- On a site where only one remote and one channel on that remote is available, both options should be selected and the list of entities should be shown upon visiting the page (AJAX loading after the rest of the page okay).
IMO it would be best if these were not select lists if only one option was available, instead just a text string was shown indicating the site name and channel, when only one is available either.
Comment | File | Size | Author |
---|---|---|---|
#5 | entity_share-pre_select_one_remote_channel-3095252-5.patch | 3.63 KB | quicksketch |
#3 | entity_share-pre_select_one_remote_channel-3095252-3.patch | 4.09 KB | Grimreaper |
Comments
Comment #2
GrimreaperComment #3
GrimreaperHi quicksketch!
Happy new year!
Here is a patch that pre-select the remote and channel and disable the select list if only one choice is available.
The automated tests are currently failing on drupal.org. There is a dedicated issue for that #3101334: Fix automated tests, so please ignore this failure.
Waiting your feedbacks before merging.
Regards,
Comment #4
quicksketchHi @Grimreaper! I ran into a problem with this patch in that
array_key_first()
is PHP 7.3+. Apparently we're using 7.2 currently. Considering the array of $channel_options is only going to have one value, we could usekey()
and still get the same result 100% of the time.So instead of
Use
Comment #5
quicksketchHere's a patch that works the same but makes that one line difference for lower versions of PHP.
Comment #6
GrimreaperHi @quicksketch,
Thanks for the test and the feedback. Here is my review:
I will change into key() too here.
I will make the change and commit.
Comment #8
GrimreaperThis is merged now!