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

Cover::build_cover_contentprivateWC 1.0

Build the cover content with background image or color.

Method of the class: Cover{}

No Hooks.

Returns

String. Cover content HTML.

Usage

// private - for code of main (parent) class only
$result = $this->build_cover_content( $inner_content ): string;
$inner_content(string) (required)
Inner content.

Cover::build_cover_content() code WC 10.4.3

private function build_cover_content( string $inner_content ): string {
	$cover_style = 'position: relative; display: inline-block; width: 100%; max-width: 100%;';

	// Wrap inner content with padding.
	// Note: $inner_content is already rendered HTML from other blocks via render_block(),
	// so it should be properly escaped by the individual block renderers.
	$inner_wrapper_style = 'padding: 20px;';
	$inner_wrapper_html  = sprintf(
		'<div class="wp-block-cover__inner-container" style="%s">%s</div>',
		$inner_wrapper_style,
		$inner_content
	);

	return sprintf(
		'<div class="wp-block-cover" style="%s">%s</div>',
		$cover_style,
		$inner_wrapper_html
	);
}