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

Abstract_Block_Renderer::add_spacerprotectedWC 1.0

Add a spacer around the block.

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

Хуков нет.

Возвращает

Строку.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->add_spacer( $content, $email_attrs ): string;
$content(строка) (обязательный)
The block content.
$email_attrs(массив) (обязательный)
The email attributes.

Код Abstract_Block_Renderer::add_spacer() WC 9.9.5

protected function add_spacer( $content, $email_attrs ): string {
	$gap_style     = WP_Style_Engine::compile_css( array_intersect_key( $email_attrs, array_flip( array( 'margin-top' ) ) ), '' );
	$padding_style = WP_Style_Engine::compile_css( array_intersect_key( $email_attrs, array_flip( array( 'padding-left', 'padding-right' ) ) ), '' );

	if ( ! $gap_style && ! $padding_style ) {
		return $content;
	}

	return sprintf(
		'<!--[if mso | IE]><table align="left" role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%%" style="%2$s"><tr><td style="%3$s"><![endif]-->
      <div class="email-block-layout" style="%2$s %3$s">%1$s</div>
      <!--[if mso | IE]></td></tr></table><![endif]-->',
		$content,
		esc_attr( $gap_style ),
		esc_attr( $padding_style )
	);
}