Skip to content

Commit

Permalink
Merge pull request #387 from Ioannis/CFM-512_Support_element-spec_ren…
Browse files Browse the repository at this point in the history
…dering_in_htmlInject_form_element

CFM-512_Support_element-spec_rendering_in_htmlInject_form_element
  • Loading branch information
satkinson authored Apr 14, 2026
2 parents e9da33b + 04491ac commit c4324ba
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions app/templates/element/form/htmlInject.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/


declare(strict_types=1);

// View vars
// $content - the text or markup to be rendered
// $content - the text or markup to be rendered OR an element spec array
// $type - accepts "subtitle" or "html"
// $vv_action

Expand All @@ -43,7 +42,16 @@
<li class="fields-subsection fields-subsection-<?= $type ?>">
<?php if($type === 'subtitle'): ?>
<h3><?= $content ?></h3>
<?php else: // we have arbitrary HTML ?>
<?= $content ?>
<?php else: ?>
<?php
// If content is an element spec, render it now (after Form->create()).
if (is_array($content) && !empty($content['element'])) {
$params = $content['params'] ?? [];
echo $this->element($content['element'], $params);
} else {
// Otherwise treat as raw HTML/text.
echo $content;
}
?>
<?php endif; ?>
</li>

0 comments on commit c4324ba

Please sign in to comment.