| @@ -30,10 +30,19 @@ | ||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $has_media_on_right = 'right' === ( $attributes['mediaPosition'] ?? null ); |
| 33 | 33 | $image_fill = (bool) ( $attributes['imageFill'] ?? false ); |
| 34 | - $focal_point = isset( $attributes['focalPoint'] ) ? round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%' : '50% 50%'; | |
| 35 | - $unique_id = 'wp-block-media-text__media-' . wp_unique_id(); | |
| 34 | + $focal_point_attr = $attributes['focalPoint'] ?? null; | |
| 35 | + $focal_point_x = null; | |
| 36 | + $focal_point_y = null; | |
| 37 | + if ( is_array( $focal_point_attr ) ) { | |
| 38 | + $focal_point_x = isset( $focal_point_attr['x'] ) && is_numeric( $focal_point_attr['x'] ) ? $focal_point_attr['x'] : null; | |
| 39 | + $focal_point_y = isset( $focal_point_attr['y'] ) && is_numeric( $focal_point_attr['y'] ) ? $focal_point_attr['y'] : null; | |
| 40 | + } | |
| 41 | + $focal_point = null !== $focal_point_x && null !== $focal_point_y | |
| 42 | + ? round( $focal_point_x * 100 ) . '% ' . round( $focal_point_y * 100 ) . '%' | |
| 43 | + : '50% 50%'; | |
| 44 | + $unique_id = 'wp-block-media-text__media-' . wp_unique_id(); | |
| 36 | 45 | |
| 37 | 46 | $block_tag_processor = new WP_HTML_Tag_Processor( $content ); |
| 38 | 47 | $block_query = array( |
| 39 | 48 | 'tag_name' => 'div', |