[wp-trac] [WordPress Trac] #43826: get_post_galleries() should return gallery blocks
WordPress Trac
noreply at wordpress.org
Wed Nov 21 07:15:40 UTC 2018
#43826: get_post_galleries() should return gallery blocks
----------------------------------------------------+---------------------
Reporter: pento | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 5.0
Component: Media | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs-testing | Focuses:
----------------------------------------------------+---------------------
Comment (by tellyworth):
attachment:43826.4.diff makes further improvements:
* It now supports json attributes in the gallery block, as per
https://github.com/WordPress/gutenberg/pull/11973
* Added `test_block_post_gallery_images_json` to cover the `<!--
wp:gallery {"ids":1,2,3} -->` case
* Added `test_mixed_post_galleries` to better cover the `$html=false`
parameter for both shortcodes and blocks (with json)
Couple of things to point out for further discussion:
1. This continues to support gallery blocks that don't contain the json
blob, by extracting img srcs from innerHtml. **Should it?**
2. For blocks, `get_post_galleries( ..., false );` should include block
attributes in the returned array, in much the same way that it does for
shortcodes (see `test_mixed_post_galleries` for details). I've made sure
the `ids` in the return array is a string, same as for shortcodes. However
it's likely that other values in the json blob won't quite match what
would be returned from a shortcode, so code that relies on
`get_post_galleries( ..., false )` might be surprised by the results.
**What's that going to break?**
I've really only unit tested this, as I don't have a good understanding of
real world use cases for these functions.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/43826#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list