WP_Duotone::restore_image_outer_container()
Fixes the issue with our generated class name not being added to the block's outer container in classic themes due to gutenberg_restore_image_outer_container from layout block supports.
Метод класса: WP_Duotone{}
Хуков нет.
Возвращает
Строку
. Filtered block content.
Использование
$result = WP_Duotone::restore_image_outer_container( $block_content );
- $block_content(строка) (обязательный)
- Rendered block content.
Список изменений
С версии 6.6.0 | Введена. |
Код WP_Duotone::restore_image_outer_container() WP Duotone::restore image outer container WP 6.6.2
public static function restore_image_outer_container( $block_content ) { if ( wp_theme_has_theme_json() ) { return $block_content; } $tags = new WP_HTML_Tag_Processor( $block_content ); $wrapper_query = array( 'tag_name' => 'div', 'class_name' => 'wp-block-image', ); if ( ! $tags->next_tag( $wrapper_query ) ) { return $block_content; } $tags->set_bookmark( 'wrapper-div' ); $tags->next_tag(); $inner_classnames = explode( ' ', $tags->get_attribute( 'class' ) ); foreach ( $inner_classnames as $classname ) { if ( 0 === strpos( $classname, 'wp-duotone' ) ) { $tags->remove_class( $classname ); $tags->seek( 'wrapper-div' ); $tags->add_class( $classname ); break; } } return $tags->get_updated_html(); }