| @@ -12,8 +12,16 @@ | ||
| 12 | 12 | 'register_attribute' => array( 'WP_Duotone_Gutenberg', 'register_duotone_support' ), |
| 13 | 13 | ) |
| 14 | 14 | ); |
| 15 | 15 | |
| 16 | +// Set up metadata prior to rendering any blocks. | |
| 17 | +if ( class_exists( 'WP_Duotone' ) ) { | |
| 18 | + remove_action( 'wp_loaded', array( 'WP_Duotone', 'set_global_styles_presets' ) ); | |
| 19 | + remove_action( 'wp_loaded', array( 'WP_Duotone', 'set_global_style_block_names' ) ); | |
| 20 | +} | |
| 21 | +add_action( 'wp_loaded', array( 'WP_Duotone_Gutenberg', 'set_global_styles_presets' ), 10 ); | |
| 22 | +add_action( 'wp_loaded', array( 'WP_Duotone_Gutenberg', 'set_global_style_block_names' ), 10 ); | |
| 23 | + | |
| 16 | 24 | // Add classnames to blocks using duotone support. |
| 17 | 25 | if ( function_exists( 'wp_render_duotone_support' ) ) { |
| 18 | 26 | // Deprecated render function. |
| 19 | 27 | remove_filter( 'render_block', 'wp_render_duotone_support' ); |
| @@ -21,9 +29,9 @@ | ||
| 21 | 29 | if ( class_exists( 'WP_Duotone' ) ) { |
| 22 | 30 | remove_filter( 'render_block', array( 'WP_Duotone', 'render_duotone_support' ) ); |
| 23 | 31 | remove_filter( 'render_block_core/image', array( 'WP_Duotone', 'restore_image_outer_container' ) ); |
| 24 | 32 | } |
| 25 | -add_filter( 'render_block', array( 'WP_Duotone_Gutenberg', 'render_duotone_support' ), 10, 3 ); | |
| 33 | +add_filter( 'render_block', array( 'WP_Duotone_Gutenberg', 'render_duotone_support' ), 10, 2 ); | |
| 26 | 34 | add_filter( 'render_block_core/image', array( 'WP_Duotone_Gutenberg', 'restore_image_outer_container' ), 10, 1 ); |
| 27 | 35 | |
| 28 | 36 | // Enqueue styles. |
| 29 | 37 | // Block styles (core-block-supports-inline-css) before the style engine (gutenberg_enqueue_stored_styles). |