-
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
[2.3] Reworked gallery.phtml to move generation of gallery json strings to own block functions #18440
[2.3] Reworked gallery.phtml to move generation of gallery json strings to own block functions #18440
Conversation
The 2.2 Backport PR is here #18443 |
Hi @sidolov, thank you for the review. |
Hi @gwharton , it's a really good changes that helps external developers customize gallery configuration, but unfortunately, we are not allowed to add new public methods to blocks that marked as @api. |
@sidolov, Thats neat. I hadn't realised you could do that. I've updated the 2.3 and 2.2 PR's accordingly. Just waiting on the Travis backlog, but pretty sure they should come in green. If not I will resolve. |
app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryOptionsTest.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php
Outdated
Show resolved
Hide resolved
|
Just waiting on a travis pass. I have reverted all changes to Gallery.php and GalleryTest.php as all active changes were moved to GalleryOptions.php and GalleryOptionsTest.php and the changes that were left in the original Gallery.php and GalleryTest.php were cleanup code unrelated to this PR and a distraction. This PR feels much cleaner now. |
Hi @sidolov, thank you for the review. |
Hi @orlangur, thank you for the review. |
✔️ QA passed |
Hi @gwharton, thank you for your contribution! |
…ry json strings to own block functions #18440
Description
Reworked gallery.phtml to move generation of gallery json strings to own block functions
Introduced unit tests to cover generation of gallery json strings with full type checking.
The resultant code is much easier to diagnose and test. It uses the json_encode and json_decode routines instead of the old manual way of generating json strings that were used in the old gallery.phtml which is prone to error and mistakes.
Fixed Issues (if relevant)
Manual testing scenarios
Stock Magento should be
and
All strings/bools/ints are now typed properly as per the Magento dev docs for the Magento 2 Gallery Widget.
Contribution checklist