Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks

Abstract_Block_Renderer::get_inner_content │ protected │ WC 1.0

Extract inner content from a wrapper element.

Removes the outer wrapper element (e.g., div) and returns only the inner HTML content. This is useful when you need to strip the wrapper and use only the inner content.

Метод класса: Abstract_Block_Renderer{}

Хуков нет.

Возвращает

string. Inner content without the wrapper element, or original content if wrapper not found.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_inner_content( $block_content, $tag_name ): string;
$block_content(строка) (обязательный)
Block content with wrapper element.
$tag_name(строка)
Tag name of the wrapper element .
По умолчанию: 'div'

Код Abstract_Block_Renderer::get_inner_content() WC 11.2.1

protected function get_inner_content( string $block_content, string $tag_name = 'div' ): string {
	$dom_helper = new Dom_Document_Helper( $block_content );
	$element    = $dom_helper->find_element( $tag_name );

	return $element ? $dom_helper->get_element_inner_html( $element ) : $block_content;
}