-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[2.2] Implement alternative fix for #12285:The option false for mobile device don't work in product view page gallery #17969
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @gwharton. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@magento-engcom-team give me test instance |
Hi @gwharton. Thank you for your request. I'm working on Magento instance for you |
Hi @gwharton, here is your new Magento instance. |
The changes to the gallery.phtml file in this PR are an interim solution. I propose to rework the gallery.phtml file with full unit testing in PR #17920 once this PR has been processed. |
2.3 also requires this change so let me know if you need a 2.3 PR first. |
Description
The original fix for #12285 made changes to the way that getVar returns variables from the view.xml file. The original fix changed it so that if the variable content was 'false' or 'true' it would return a boolean value of false or true instead of returning the string value of the boolean as it did before.
Unfortunately this change means that you can no longer tell the difference between the variable existing and being set to false, and the variable not actually existing.
A call to getVar for any random variable name will return false if it doesn't exist, and also false if it happened to exist and was set to 'false'.
This is not good.
This change reverts that change so that the function returns boolean false if the variable name does not exist, and returns the string 'false' if it exists and is set to false. It will always return the string value of the variable contents regardless of the type.
I have reimplemented the fix in a different way, parsing recursively through the Breakpoints array, changing any string 'true' to boolean true and string 'false' to boolean false before parsing into json for sending to browser. This ensures the original #12285 issue remains fixed.
Fixed Issues (if relevant)
Alternative fix for issue
Manual testing scenarios
edit file /etc/view.xml
add
<var name="allowfullscreen">false</var>
to mobile breakpointsExample:
clean cache and open source html
find plugin "mage/gallery/gallery" init options on html page.
Check that the option "allowfullscreen" value is being output as boolean and not string.
"breakpoints": {"mobile":{"conditions":{"max-width":"767px"},"options":{"options":{"navigation":"dots","allowfullscreen":false}}}} }
Contribution checklist