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.
Now that #3014649: Allow multiple variants to be set per bundle via UI has been implemented, we should either clone the new functionality from Drupal\simple_sitemap\Form\FormHelper::displayEntitySettings, or abstract/change it so it can be used in Drupal\simple_sitemap_views\Plugin\views\display_extender\SimpleSitemapDisplayExtender.
This is in order to be able to index a view display in several variants at the same time from the UI. I don't think this is urgent, but would be great to have at some point.
Comment | File | Size | Author |
---|---|---|---|
#20 | view-display-multiple-variants-3054239-20.patch | 48.74 KB | WalkingDexter |
|
Comments
Comment #2
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedComment #3
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedComment #4
WalkingDexter CreditAttribution: WalkingDexter at Initlab commentedCurrently, the display extender settings have the following structure:
I think that to solve this issue, we can use the new structure:
However, this will require changing the views.display_extender.simple_sitemap_display_extender schema. We also need a new implementation of the hook_update_N to change the structure of settings that are already saved.
Comment #5
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedThat's fine with me, I believe users of the module have gotten used to the constantly changing configuration/data structure. ;)
Comment #6
init90I've encountered with such case when worked with multi-domains sitemaps. I have a few views which display domain specified content, for every domain I have a separate sitemap variant. My purpose was to add a few variants to needed view in order to get view link for a different domains sitemaps.
Attached patch only supports multi-variants without ability add separate options per variant.
Comment #7
WalkingDexter CreditAttribution: WalkingDexter at Initlab commented@init90 thank you for contributing! However, I note that there is a significant problem in your patch - there is no way to set different settings for each sitemap variant. We need the structure described in #4.
Comment #8
init90>However, I note that there is a significant problem in your patch - there is no way to set different settings for each sitemap variant.
Yes, my patch provides only a quick solution for multi variants support, without options per variant.
I agree that the concept described in comment #4 is more propper.
According to comment #4, I have a question about the UI part.
How it should look? Maybe fieldsets list, where every fieldset is separate sitemap variant?
Comment #9
WalkingDexter CreditAttribution: WalkingDexter at Initlab commentedI think it should look like this:
Separate form for each variant.
Comment #10
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedWhatever you guys do, bear in mind, there can be 5000 variants, so it would make sense to at least hide them in a field set so they don't destroy the view layout or something.
Comment #11
init90>I think it should look like this:
Looks good, thank you.
>Whatever you guys do, bear in mind, there can be 5000 variants, so it would make sense to at least hide them in a field set so they don't destroy the view layout or something.
Hard to imagine the case when needed 5000 sitemaps variants, nonetheless it's a good point and should be counted. Thanks!
Comment #12
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedNot too hard to imagine; originally the variants were created for a wholesaler that uses this module as an API feeding its product variants to shops. They have thousands of variants going on.
Comment #13
WalkingDexter CreditAttribution: WalkingDexter at Initlab commented@gbyte.co, is the current UI adapted to this case? For example, on the node type edit page, in the "Simple XML Sitemap" block, each variant is a "details" element. If there are 5000 variants, it will look bad. In addition, most likely, the form will not be submitted due to the large number of elements (max_input_vars).
I'm not sure that we need to take this case into account, since the current UI is also not adapted for it.
Comment #14
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedThe variants however are hidden in a fieldset, so when editing the node type, the layout does not break. My concern is for the views edit page layout not to break when editing the view, which would be the case with hundreds of variants and the design proposed in #9.
Comment #15
paulmartin84 CreditAttribution: paulmartin84 at Inviqa commentedI've run into some issues where this is not working with multiple variants. It seems that we are destroying the view as soon as we get to a variant that the view doesn't index in to. I've removed that destroy code now and that seems to have fixed it for me at least.
Comment #16
paulmartin84 CreditAttribution: paulmartin84 at Inviqa commentedComment #17
WalkingDexter CreditAttribution: WalkingDexter at Initlab commentedPatch with solution. So far, no hook_update_N implementation. Will definitely work with a clean install of the module.
Comment #18
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commented@WalkingDexter good to hear from you. Wow quite a big patch, let's add the update hook and commit!
Comment #19
WalkingDexter CreditAttribution: WalkingDexter at Initlab commentedComment #20
WalkingDexter CreditAttribution: WalkingDexter at Initlab commentedAdded hook_update_N implementation.
Comment #21
WalkingDexter CreditAttribution: WalkingDexter at Initlab commented@gbyte please note that I no longer have commit permissions.
Comment #23
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commentedThanks. The only improvement we could add on top is abstracting Drupal\simple_sitemap\Form\FormHelper::displayEntitySettings and using it to display the sitemap settings to avoid code duplication. But this is so low priority, I am happy to mark this as fixed.
@WalkingDexter Great work as always! If you feel you have the capacity to continue contributing, I'm happy to reinstate commiter access.
Comment #24
WalkingDexter CreditAttribution: WalkingDexter at Initlab commented@gbyte I am glad to help :) Thanks, access will be useful. As before, I cannot guarantee that I will always have enough time to work on the module.
Comment #25
gbyte CreditAttribution: gbyte as a volunteer and at gbyte commented@WalkingDexter Restored write access to vcs, but it may be removed after a very long period of idleness.