styleUtils = $styleUtils; $this->settings = $settings; $this->blocksRenderer = $blocksRenderer; $this->customFonts = $customFonts; } public function renderStyles(array $form, string $prefix, string $displayType): string { $this->customFonts->enqueueStyle(); $html = ''; return $html; } public function renderHTML(array $form = []): string { if (isset($form['body']) && !empty($form['body'])) { return $this->renderBlocks($form['body'], $form['settings'] ?? []); } return ''; } public function getCustomStyles(array $form = []): string { if (isset($form['styles']) && strlen(trim($form['styles'])) > 0) { return strip_tags($form['styles']); } else { return FormTemplate::DEFAULT_STYLES; } } public function renderBlocks(array $blocks = [], array $formSettings = [], bool $honeypotEnabled = true): string { // 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) { $html .= $this->renderReCaptcha(); } if (in_array($block['type'], ['column', 'columns'])) { $blocks = $block['body'] ?? []; $html .= $this->blocksRenderer->renderContainerBlock($block, $this->renderBlocks($blocks, $formSettings, false)) . PHP_EOL; } else { $html .= $this->blocksRenderer->renderBlock($block, $formSettings) . PHP_EOL; } } return $html; } private function renderHoneypot(): string { return ''; } private function renderReCaptcha(): string { $siteKey = $this->settings->get('captcha.recaptcha_site_token'); return '
'; } }