Skip to content

Commit

Permalink
Move lightbox render function to filter (#54670)
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiomorales authored and mikachan committed Sep 29, 2023
1 parent ff67ea7 commit 9dea2a3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/block-library/src/image/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ function render_block_core_image( $attributes, $content, $block ) {
}

if ( $lightbox_enabled ) {
return block_core_image_render_lightbox( $processor->get_updated_html(), $block->parsed_block );
// This render needs to happen in a filter with priority 15 to ensure that it
// runs after the duotone filter and that duotone styles are applied to the image
// in the lightbox. We also need to ensure that the lightbox works with any plugins
// that might use filters as well. We can consider removing this in the future if the
// way the blocks are rendered changes, or if a new kind of filter is introduced.
add_filter( 'render_block_core/image', 'block_core_image_render_lightbox', 15, 2 );
}

return $processor->get_updated_html();
Expand Down

0 comments on commit 9dea2a3

Please sign in to comment.