Skip to content

Commit c37380e

Browse files
Properly rename textarea tags for text metadata elements when embedded in view bundle template
1 parent d692e1c commit c37380e

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

app/helpers/htmlFormHelpers.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ function caHTMLTextInput($name, $attributes=null, $options=null) {
143143
$is_textarea = false;
144144
$va_styles = array();
145145

146+
$tag_name = caGetOption('textAreaTagName', $options, 'textarea');
147+
146148
if(isset($attributes['style']) && $attributes['style']) {
147149
$va_styles[] = $attributes['style'];
148150
}
@@ -245,7 +247,7 @@ function caHTMLTextInput($name, $attributes=null, $options=null) {
245247

246248
$attr_string = _caHTMLMakeAttributeString($attributes, $options);
247249
$element .= "<div id=\"{$name}_container\" style='width: {$width}px; height: {$height}px; overflow-y: auto;'>
248-
<textarea name=\"{$name}\" id=\"{$name}\">{$attributes['value']}</textarea></div>
250+
<{$tag_name} name=\"{$name}\" id=\"{$name}\">{$attributes['value']}</{$tag_name}></div>
249251
<style>
250252
#{$name}_container .ck-editor__editable_inline {
251253
min-height: calc({$height}px - 100px);
@@ -287,7 +289,6 @@ function caHTMLTextInput($name, $attributes=null, $options=null) {
287289
$o_config = Configuration::load();
288290
if(!is_array($va_toolbar_config = $o_config->getAssoc(caGetOption('cktoolbar', $options, 'wysiwyg_editor_toolbar')))) { $va_toolbar_config = []; }
289291
} elseif ($is_textarea) {
290-
$tag_name = caGetOption('textAreaTagName', $options, 'textarea');
291292
$value = $attributes['value'] ?? null;
292293
if ($attributes['size'] ?? null) { $attributes['cols'] = $attributes['size']; }
293294
unset($attributes['size']);

app/lib/Attributes/Values/TextAttributeValue.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,20 +366,23 @@ public function htmlFormElement($element_info, $options=null) {
366366
$class = trim((isset($options['class']) && $options['class']) ? $options['class'] : '');
367367
$element = '';
368368

369-
$opts = [
369+
$attr = [
370370
'width' => $width.(is_numeric($width) ? 'px' : ''),
371371
'height' => $height.(is_numeric($height) ? 'px' : ''),
372372
'value' => '{{'.$element_info['element_id'].'}}',
373373
'id' => '{fieldNamePrefix}'.$element_info['element_id'].'_{n}',
374-
'class' => "{$class}",
374+
'class' => "{$class}"
375+
];
376+
$opts = [
377+
'textAreaTagName' => caGetOption('textAreaTagName', $options, null)
375378
];
376379
$attributes = caGetOption('attributes', $options, null);
377380
if(is_array($attributes)) {
378-
$opts = array_merge($attributes, $opts);
381+
$attr = array_merge($attributes, $opts);
379382
}
380383

381384
if (caGetOption('readonly', $options, false)) {
382-
$opts['disabled'] = 1;
385+
$attr['disabled'] = 1;
383386
}
384387

385388
if ($settings['usewysiwygeditor'] ?? null) {
@@ -439,7 +442,7 @@ public function htmlFormElement($element_info, $options=null) {
439442

440443
$element .= "<div style='width: {$width_w_suffix}; height: {$height_w_suffix}; overflow-y: auto;' class='{fieldNamePrefix}{$element_info['element_id']}_container_{n} ckeditor-wrapper'>".caHTMLTextInput(
441444
'{fieldNamePrefix}'.$element_info['element_id'].'_{n}',
442-
$opts
445+
$attr, $opts
443446
)."</div><style>
444447
.{fieldNamePrefix}{$element_info['element_id']}_container_{n} .ck-editor__editable_inline {
445448
min-height: calc({$height}px - 100px);
@@ -468,20 +471,20 @@ public function htmlFormElement($element_info, $options=null) {
468471
".json_encode($quill_opts)."
469472
);
470473
</script>\n";
471-
$opts['style'] = 'display: none;';
474+
$attr['style'] = 'display: none;';
472475
$element .= "<div id='{fieldNamePrefix}".$element_info['element_id']."_editor_{n}' style='height: {$height_w_suffix};' class='ql-ca-editor'></div>";
473476

474477
$element .= caHTMLTextInput(
475478
'{fieldNamePrefix}'.$element_info['element_id'].'_{n}',
476-
$opts
479+
$attr, $opts
477480
);
478481
$element .= "</div>\n";
479482
break;
480483
}
481484
} else {
482485
$element .= caHTMLTextInput(
483486
'{fieldNamePrefix}'.$element_info['element_id'].'_{n}',
484-
$opts
487+
$attr, $opts
485488
);
486489
}
487490

0 commit comments

Comments
 (0)