Skip to content
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

Image lightbox: move image data from context to state #63348

Merged
merged 8 commits into from
Jul 15, 2024
Prev Previous commit
Next Next commit
Use hash instead of counter for the unique id
  • Loading branch information
luisherranz committed Jul 12, 2024
commit 189c7f51dc2bd395ca80c3a1435ecf4b0f76a9a4
3 changes: 2 additions & 1 deletion packages/block-library/src/image/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ function block_core_image_render_lightbox( $block_content, $block ) {
$figure_styles = $p->get_attribute( 'style' );

// Create unique id and set the image metadata in the state.
$unique_image_id = wp_unique_id( 'image-' );
$unique_image_id = substr( md5( $img_uploaded_src ), 0, 10 );

wp_interactivity_state(
'core/image',
array(
Expand Down