Render font size

[MAILPOET-2600]
This commit is contained in:
Pavel Dohnal
2020-02-26 14:09:15 +01:00
committed by Jack Kitterhing
parent ce127eadc1
commit 691a8a45f3
23 changed files with 83 additions and 87 deletions

View File

@ -82,7 +82,7 @@ class BlockRendererHelper {
return join(' ', $validation);
}
public function renderLabel(array $block): string {
public function renderLabel(array $block, array $formSettings): string {
$html = '';
if (
isset($block['params']['hide_label'])
@ -98,7 +98,10 @@ class BlockRendererHelper {
}
if (isset($block['params']['label'])
&& strlen(trim($block['params']['label'])) > 0) {
$html .= '<label class="mailpoet_' . $block['type'] . '_label">';
$html .= '<label '
. 'class="mailpoet_' . $block['type'] . '_label" '
. $this->renderFontStyle($formSettings)
. '>';
$html .= htmlspecialchars($block['params']['label']);
if (isset($block['params']['required']) && $block['params']['required']) {
@ -110,6 +113,13 @@ class BlockRendererHelper {
return $html;
}
public function renderFontStyle(array $formSettings) {
if (isset($formSettings['fontSize'])) {
return 'style="font-size: ' . trim($formSettings['fontSize']) . 'px"';
}
return '';
}
public function renderInputPlaceholder(array $block): string {
$html = '';
// if the label is displayed as a placeholder,