<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\Form\Block; if (!defined('ABSPATH')) exit; use MailPoet\Form\BlockStylesRenderer; use MailPoet\Form\BlockWrapperRenderer; use MailPoet\WP\Functions as WPFunctions; class Textarea { /** @var BlockRendererHelper */ private $rendererHelper; /** @var BlockStylesRenderer */ private $inputStylesRenderer; /** @var BlockWrapperRenderer */ private $wrapper; /** @var WPFunctions */ private $wp; public function __construct( BlockRendererHelper $rendererHelper, BlockStylesRenderer $inputStylesRenderer, BlockWrapperRenderer $wrapper, WPFunctions $wp ) { $this->rendererHelper = $rendererHelper; $this->inputStylesRenderer = $inputStylesRenderer; $this->wrapper = $wrapper; $this->wp = $wp; } public function render(array $block, array $formSettings, ?int $formId = null): string { $html = ''; $name = $this->rendererHelper->getFieldName($block); $styles = $this->inputStylesRenderer->renderForTextInput($block['styles'] ?? [], $formSettings); $html .= $this->rendererHelper->renderLabel($block, $formSettings); $lines = (isset($block['params']['lines']) ? (int)$block['params']['lines'] : 1); $html .= $this->inputStylesRenderer->renderPlaceholderStyles($block, 'textarea[name="data[' . $name . ']"]'); $html .= '<textarea class="mailpoet_textarea" data-automation-id="form_custom_text_area" rows="' . $lines . '" '; $html .= 'name="data[' . $name . ']"'; $html .= $this->rendererHelper->renderInputPlaceholder($block); $html .= $this->rendererHelper->getInputValidation($block); $html .= $this->rendererHelper->getInputModifiers($block); if ($styles) { $html .= 'style="' . $this->wp->escAttr($styles) . '" '; } $html .= '>' . $this->rendererHelper->escapeShortCodes($this->rendererHelper->getFieldValue($block)) . '</textarea>'; $html .= $this->rendererHelper->renderErrorsContainer($block, $formId); return $this->wrapper->render($block, $html); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
BlockRendererHelper.php | File | 10.02 KB | 0644 |
|
Checkbox.php | File | 2.4 KB | 0644 |
|
Column.php | File | 2.02 KB | 0644 |
|
Columns.php | File | 2.28 KB | 0644 |
|
Date.php | File | 7.85 KB | 0644 |
|
Divider.php | File | 1.97 KB | 0644 |
|
Heading.php | File | 3.56 KB | 0644 |
|
Html.php | File | 1.15 KB | 0644 |
|
Image.php | File | 3.18 KB | 0644 |
|
Paragraph.php | File | 3.22 KB | 0644 |
|
Radio.php | File | 2.31 KB | 0644 |
|
Segment.php | File | 2.82 KB | 0644 |
|
Select.php | File | 3.09 KB | 0644 |
|
Submit.php | File | 1.7 KB | 0644 |
|
Text.php | File | 2.75 KB | 0644 |
|
Textarea.php | File | 2.07 KB | 0644 |
|
index.php | File | 6 B | 0644 |
|