From 0db5e2087a9eb2d3aa4a9da89d676ceb25970d43 Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Tue, 7 Jul 2020 14:21:50 +0200 Subject: [PATCH] feat(mjml): handle social icons block aligment options --- includes/class-newspack-newsletters-renderer.php | 8 ++++++-- src/editor/index.js | 7 +------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/includes/class-newspack-newsletters-renderer.php b/includes/class-newspack-newsletters-renderer.php index 1385fcd6f..646bfce70 100644 --- a/includes/class-newspack-newsletters-renderer.php +++ b/includes/class-newspack-newsletters-renderer.php @@ -403,14 +403,18 @@ private static function render_mjml_component( $block, $is_in_column = false, $i ); $social_wrapper_attrs = array( - 'align' => isset( $attrs['align'] ) && 'center' == $attrs['align'] ? 'center' : 'left', 'icon-size' => '22px', 'mode' => 'horizontal', 'padding' => '0', 'border-radius' => '999px', 'icon-padding' => '8px', ); - $markup = ''; + if ( isset( $attrs['align'] ) ) { + $social_wrapper_attrs['align'] = $attrs['align']; + } else { + $social_wrapper_attrs['align'] = 'left'; + } + $markup = ''; foreach ( $inner_blocks as $link_block ) { if ( isset( $link_block['attrs']['url'] ) ) { $url = $link_block['attrs']['url']; diff --git a/src/editor/index.js b/src/editor/index.js index b8857bffe..0fddc89e0 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -27,12 +27,7 @@ domReady( () => { addFilter( 'blocks.registerBlockType', 'newspack-newsletters/core-blocks', ( settings, name ) => { /* Remove left/right alignment options wherever possible */ - if ( - 'core/paragraph' === name || - 'core/social-links' === name || - 'core/buttons' === name || - 'core/columns' === name - ) { + if ( 'core/paragraph' === name || 'core/buttons' === name || 'core/columns' === name ) { settings.supports = { ...settings.supports, align: [] }; } if ( 'core/group' === name ) {