Problem/Motivation
#3479245: JS Warning About Not Enough Slides introduced many problems:
* PHP warning because of sometimes `count()` on NULL.
* Despite the permissions check, this patch doesn't set cache contexts, so the warning message will be cached and shown to anonymous visitors.
* I'm unsure why a content editor needs to be told that a widget is choosing option B instead of option A. This is just confusion inducing.
* IMO the JS console message is a _good_ thing to help debug what's going on. IMO there's no need to remove it in the first place, though I understand why others might disagree.
Steps to reproduce
Create content with only one or zero items in the Swiper.
Proposed resolution
Adjust `template_preprocess_swiper_formatter()` to fix problems 1–3. We can leave 4 as-is.
Remaining tasks
review and commit
User interface changes
no more warning message about only 1 item
API changes
none
Data model changes
none
Issue fork swiper_formatter-3567577
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 2.1.x
changes, plain diff MR !30
- 3567577-fix-uxjscachingphp-issues
compare
Comments
Comment #2
dalinComment #4
dalinComment #5
dalinComment #6
bbu23Hi,
Thanks for reporting this major issue.
Indeed, there's no point in seeing a message about the choice.
I don't see an open merge request, so I'm adjusting the status back to Active until there's something available for review.
Comment #8
dalinThe multi-step process always throws me off. There's now an MR.
Comment #9
bbu23No worries, thank you for taking the time to provide the MR.
We will review it as soon as possible.
Comment #12
bbu23Backported to 2.0.x as well, thanks.
Will be available in 2.0.3 and 2.1.0.
Comment #14
dalin@bbu23
Could you give contribution credit for this?
Comment #15
bbu23@dalin Of course, but I checked and it seems that you already have credit for this, is it not showing to you? 🤔
Comment #16
dalin@bbu23
You are correct. Sorry, the SSO system across multiple domains tripped me up.