Skip to content

Commit

Permalink
Improve syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiomorales committed Jun 1, 2023
1 parent 6dbe22a commit d8fc1a3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/block-library/src/image/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ function render_block_core_image( $attributes, $content ) {
$content = $processor->get_updated_html();

$w = new WP_HTML_Tag_Processor( $content );
$w->next_tag(
array(
'tag_name' => 'figure',
)
);
$w->next_tag( 'figure' );
$w->add_class( 'wp-lightbox-container' );
$w->set_attribute( 'data-wp-interactive', '' );
$w->set_attribute( 'data-wp-context', '{ "core": { "image": { "initialized": false, "lightboxEnabled": false } } }' );
Expand Down Expand Up @@ -106,7 +102,7 @@ function render_block_core_image( $attributes, $content ) {
</div>
HTML;

return preg_replace( '/<\/figure>/', $lightbox_html . '</figure>', $body_content );
return str_replace( '</figure>', $lightbox_html . '</figure>', $body_content );
}

return $processor->get_updated_html();
Expand Down

0 comments on commit d8fc1a3

Please sign in to comment.