Fix rendering issues in form blocks

[MAILPOET-3415]
This commit is contained in:
Rostislav Wolny
2021-02-11 12:45:49 +01:00
committed by Veljko V
parent 6e911ffd1d
commit c1aef842d2
29 changed files with 196 additions and 58 deletions

View File

@ -2,9 +2,18 @@
namespace MailPoet\Form;
use MailPoet\WP\Functions as WPFunctions;
class BlockWrapperRenderer {
/** @var WPFunctions */
private $wp;
public function __construct(WPFunctions $wp) {
$this->wp = $wp;
}
public function render(array $block, string $blockContent): string {
$classes = isset($block['params']['class_name']) ? " " . $block['params']['class_name'] : '';
return '<div class="mailpoet_paragraph' . $classes . '">' . $blockContent . '</div>';
return '<div class="mailpoet_paragraph' . $this->wp->escAttr($classes) . '">' . $blockContent . '</div>';
}
}