Thanks to this issue: https://github.com/kenwheeler/slick/issues/3149
i found out where those unwanted divs came from. If rows is set to 1 instead of 0, the .slick__slide's are wrapped again in .slick-slide's + an classless div.
Patch follows.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 3123787-14.patch | 1.8 KB | thomas.frobieter |
| #12 | 3123787-12.patch | 1.65 KB | thomas.frobieter |
| #11 | 3123787-11.patch | 1.57 KB | thomas.frobieter |
| #9 | 3123787-9.patch | 1.46 KB | thomas.frobieter |
| #3 | Screenshot_20200331-185315.jpg | 187.46 KB | gausarts |
Comments
Comment #2
thomas.frobieterComment #3
gausarts commentedThank you.
The library default value, and its docs sets
rowsto 1:http://kenwheeler.github.io/slick/
If we changed it, it will break pre 1.8.1.
There is a different minimum value and logic to this between branches.
I don't know how to deal with it. We cannot simply change that number.
FYI, sometimes I prefer 1.6, and your patch will break that version.
If you have a better idea to handle this, please update.
This is not module bug, just library latest change, so worth a Task.
Comment #4
thomas.frobieterOk, yes, this is problematic.
I agree the problem is up to the library, but the chance they will fix this in the near future is nearly 0. And we should prevent others from wasting time on this problem?
Is it possible to show a warning message above a Slick settings configuration page, if library version is >1.8 AND a rows field is set to 1?
"'row' is set to 1, this will result in unnecessary markup, because of a Slick library bug. Consider to set 0 instead if you don't want to use the row feature."
Maybe you could do a break with the D9 release of this module.. require >1.8 and set the default to 0.. even if its against the slick default / documentation.
Comment #5
thomas.frobieterUpdated the title so others can find this more easily.
Comment #6
gausarts commentedYes, warning is less troublesome. Unless you have time to cross-check against versions.
Basically I don't know yet how to deal with different versions. I just checked, even the latest release still sets this to 1.
If made different, I have no time to verify against or simply read the library code if any is hard-coded or not with this value. No time to debug if any issue like what you have now across versions.
If anyone have free time and are confident to verify, feel free to proceed.
However if you should change it after confident checks, consider a hook update to change default optionset with the relevant line at slick.optionset.default.yml and likely the entire stored optionsets with careful checks such as those using this option bigger > 1, and those without, aside from your lines.
And any other place, if any. I hope not.
Comment #7
thomas.frobieterSorry, not much time at the moment, i didn't had a deeper look into this already.
Just one additional note to this problem: If "slides per row" is set to 0, the browser (especially Firefox) crashes. Maybe also worth a warning message... preventing others from debugging this shit.
Comment #8
gausarts commentedOK. Let's keep it open for a while, then.
Added tags for easy finding. Thanks for sharing.
Comment #9
thomas.frobieterOk done some testing with the Slick versions..
Seems the change was made in v. 1.9.0:
https://codepen.io/collection/APyjyZ
However, i've searched for ways to get the library version in Drupal, the only way here is the package.json and this feature is N/A yet in the libraries API: https://www.drupal.org/project/libraries/issues/2699799
So i've just checked if the critical values are set and print out messages.
Please double check my changes, i'm not a pro PHP developer ;)
Comment #10
gausarts commentedThat is helpful. Thank you.
Just few nits:
!empty()toisset()for just in case0is considered empty. Ignore if not.drupal_set_message()was deprecated in favor of Messenger service. There is a sample at thatSlickFormBaseform at::save().t()to$this->t()unless for static methods.Comment #11
thomas.frobieterThanks! Update attached.
Comment #12
thomas.frobieterDamn it, sorry, forgot to copy over my latest changes, again!
Comment #13
gausarts commentedThank you. Just one last bit.
I forgot to detail, sorry. The link should be put in a variable:
<a href=":url">...</a>Then pass the value at the second param of
t().There is a similar sample on ::save too.
Comment #14
thomas.frobieterNP, thanks for the advice.
Comment #16
gausarts commentedTruly sorry for terrible delay.
This needs better handles, perhaps via JS for immediate hints.
Currently it is a bit confusing, and doesn't validate the installed version.
However it is better than broken :)
Added a space and minor message to avoid back and forth confusion:
, or leave it as if not using >1.9.0Committed. Thank you for contribution and patience.
Comment #18
gausarts commented