| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | protected $supported_core_blocks = [ |
| 26 | 26 | 'core/paragraph' => [ 'content' ], |
| 27 | 27 | 'core/heading' => [ 'content' ], |
| 28 | 28 | 'core/button' => [ 'text', 'url', 'linkTarget', 'rel' ], |
| 29 | - 'core/image' => [ 'id', 'url', 'title', 'alt' ], | |
| 29 | + 'core/image' => [ 'id', 'url', 'title', 'alt', 'caption' ], | |
| 30 | 30 | ]; |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Define a list of supported block binding |
| @@ -355,8 +355,19 @@ | ||
| 355 | 355 | } elseif ( 'boldblocks/youtube-block' === $block_instance->name ) { |
| 356 | 356 | if ( function_exists( 'better_youtube_embed_block_render_block' ) ) { |
| 357 | 357 | // Merge with dynamic content. |
| 358 | 358 | $attributes = array_merge( $block_instance->attributes, $computed_attributes ); |
| 359 | + | |
| 360 | + // Get caption from the markup if there is no binding value. | |
| 361 | + if ( ! isset( $computed_attributes['caption'] ) ) { | |
| 362 | + $caption = $this->the_plugin_instance->get_component( CustomStyle::class )->get_element_inner_html( $block_content, 'FIGCAPTION' ); | |
| 363 | + if ( $caption ) { | |
| 364 | + $attributes['caption'] = $caption; | |
| 365 | + } | |
| 366 | + } | |
| 367 | + | |
| 368 | + // Allow inline tags. | |
| 369 | + $attributes['caption_kses'] = true; | |
| 359 | 370 | |
| 360 | 371 | return better_youtube_embed_block_render_block( $attributes ); |
| 361 | 372 | } |
| 362 | 373 | } elseif ( 'boldblocks/counting-number' === $block_instance->name ) { |