Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks
Post_Template::extract_remaining_content
Read back the card content left after the images were removed, or an empty string when nothing but structural wrapper shells remain (so image-only cards stay a clean grid).
Method of the class: Post_Template{}
No Hooks.
Returns
string.
Usage
// private - for code of main (parent) class only $result = $this->extract_remaining_content( $item_dom ): string;
- $item_dom(Dom_Document_Helper) (required)
- The item DOM after image removal.
Post_Template::extract_remaining_content() Post Template::extract remaining content code WC 11.1.2
private function extract_remaining_content( Dom_Document_Helper $item_dom ): string {
$this->strip_unsafe_markup( $item_dom );
$remainder = $item_dom->get_root_html();
// Treat the remainder as empty unless it carries visible text or embedded media — otherwise it
// is just the leftover wrapper markup (empty figures/tables) the image used to live in.
if ( '' === trim( str_replace( "\xc2\xa0", '', wp_strip_all_tags( $remainder ) ) )
&& ! preg_match( '/<(img|video|audio|iframe|svg)\b/i', $remainder ) ) {
return '';
}
return $remainder;
}