Skip to content

Commit

Permalink
Allow htmlInject content to render elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Apr 13, 2026
1 parent e9da33b commit 04491ac
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 04491ac

Please sign in to comment.