MailPoet\EmailEditor\Integrations\Core\Renderer\Blocks
Abstract_Block_Renderer::add_spacer()
Add a spacer around the block.
Method of the class: Abstract_Block_Renderer{}
No Hooks.
Return
String
.
Usage
// protected - for code of main (parent) or child class $result = $this->add_spacer( $content, $email_attrs ): string;
- $content(string) (required)
- The block content.
- $email_attrs(array) (required)
- The email attributes.
Abstract_Block_Renderer::add_spacer() Abstract Block Renderer::add spacer code WC 9.8.1
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 ) ); }