-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Magento_Catalog: gallery - fotorama__caption show/hide #16941
Conversation
The fotorama version in 2.2.5 in includes a parameter for `captions` in addition to `showCaption`, which defaults to true and shows the caption below the gallery image, there is no way to control this in the traditional sense, besides hiding with CSS or adding a plugin use the `setOptions()` function.
Hi @joe-vortex. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
If captions is true, no need to output it (default), If captions is false, output `captions: false`
Thanks for your contribution @joe-vortex! I'll process this one and report back. |
Hi @miguelbalparda, thank you for the review. |
@joe-vortex thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
Thanks @miguelbalparda ! |
Heads up guys, this might clash with the following open PR's: #16594 or #15546. More context: #15009 /cc @gwharton Even though this is a different variable Just commenting and warning in here, because I was involved in issues regarding the above PR's today which seem to also solve the same thing as this PR is trying to solve. |
I dont believe we need this captions option. The correct way of not showing the caption below the images is to set gallery/caption and gallery/fullscreen/caption to false in the config. This is in accordance with the Magento developer docs at https://devdocs.magento.com/guides/v2.2/javascript-dev-guide/widgets/widget_gallery.html The above variables are set by default but unfortunately there is a bug in the 2.2.5 gallery.phtml which means that it does not handle boolean variables correctly resulting in the relevant fotorama setup variable (showCaption) never being output, even though it is defined in the default view.xml. I believe the correct fix for this issue is to apply PR#16594 which not only fixes the gallery.phtml for showCaption, but also for all other booleans in view.xml which arent applied correctly either. I have PR#16594 applied to 2.2.5 and do NOT have captions set in my view.xml and the captions are not displayed under the images. Note that the fixes in PR #16594 were previously applied back around 2.2.3/2.2.4 time, but were accidentally reverted (by me....... Arghh) which meant that 2.2.5 shipped without them. |
Also note the new behaviour of the code $block->getVar("name") when the variable contains either the text true or false. Since 2.2.4 The function will return boolean true if the variable "name" is present and has the text true There is no way to differentiate between the variable not existing, and it existing but is false. Hence, the need to update ALL of the boolean options in gallery.phtml, hence #16594... :) |
@gwharton I noticed this too. The variable default is true and the getvar function would just not output anything. I have tested this by hard setting If your PR is going to be included in the next release then we could close my PR. This was my first contribution. Better luck next time I guess |
No worries @joe-vortex! We really appreciate having multiple options, I'll double check this internally and let you know what the next steps are. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still discussin between this one and #16594
Closing in favor of #16594. Thanks for your contribution @joe-vortex, sorry for all the back and forth!!! |
Issue
The fotorama version in 2.2.5 in includes a parameter for
captions
in addition toshowCaption
, which defaults to true and shows the caption below the gallery image, there is no way to control this in the traditional sense, besides hiding with CSS or adding a plugin using thesetOptions()
function.Testing
With the blank/luma default view.xml vars:
The
fotorama__caption
element should be hidden on screen.Contribution checklist