Skip to content

Commit

Permalink
Change processor name and args
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Jul 3, 2024
1 parent 4e77262 commit 825f78e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/wp-includes/class-wp-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,10 @@ private function replace_html( string $block_content, string $attribute_name, $s
case 'rich-text':
if ( 'core/image' === $this->name && 'caption' === $attribute_name ) {
// Create private anonymous class until the HTML API provides `set_inner_html` method.
$bindings_processor = new class( $block_content, WP_HTML_Processor::CONSTRUCTOR_UNLOCK_CODE ) extends WP_HTML_Processor {
$bindings_processor_builder = new class(
'Do not use this, it will not work. It is only here to create a subclass and call the static creator method',
WP_HTML_Processor::CONSTRUCTOR_UNLOCK_CODE
) extends WP_HTML_Processor {
/**
* Replace the inner content of a figcaption element with the passed content.
*
Expand Down Expand Up @@ -384,7 +387,7 @@ public function set_figcaption_inner_html( $new_content ) {
}
};

$block_reader = $bindings_processor::create_fragment( $block_content );
$block_reader = $bindings_processor_builder::create_fragment( $block_content );
if ( $block_reader->next_tag( 'figcaption' ) ) {
$block_reader->set_figcaption_inner_html( $source_value );
}
Expand Down

0 comments on commit 825f78e

Please sign in to comment.