Add PHP constants for form block types

[MAILPOET-3297]
This commit is contained in:
Rostislav Wolny
2020-12-28 09:26:05 +01:00
committed by Veljko V
parent a018d77505
commit b3db3dbcb3
3 changed files with 35 additions and 17 deletions

View File

@@ -2,6 +2,7 @@
namespace MailPoet\Form;
use MailPoet\Entities\FormEntity;
use MailPoet\Form\Templates\FormTemplate;
use MailPoet\Form\Util\CustomFonts;
use MailPoet\Form\Util\Styles;
@@ -64,10 +65,10 @@ class Renderer {
// add honeypot for spambots
$html = ($honeypotEnabled) ? $this->renderHoneypot() : '';
foreach ($blocks as $key => $block) {
if ($block['type'] == 'submit' && $this->settings->get('captcha.type') === Captcha::TYPE_RECAPTCHA) {
if ($block['type'] === FormEntity::SUBMIT_BLOCK_TYPE && $this->settings->get('captcha.type') === Captcha::TYPE_RECAPTCHA) {
$html .= $this->renderReCaptcha();
}
if (in_array($block['type'], ['column', 'columns'])) {
if (in_array($block['type'], [FormEntity::COLUMN_BLOCK_TYPE, FormEntity::COLUMNS_BLOCK_TYPE])) {
$blocks = $block['body'] ?? [];
$html .= $this->blocksRenderer->renderContainerBlock($block, $this->renderBlocks($blocks, $formSettings, false)) . PHP_EOL;
} else {