add form help blocks: DB table, admin editor, live rendering in partage form

This commit is contained in:
Pontoporeia
2026-04-29 21:08:09 +02:00
parent 0437ec8d15
commit 670a38f30d
7 changed files with 136 additions and 29 deletions

View File

@@ -0,0 +1,26 @@
<?php
/**
* Renders a single form help block as HTML.
*
* Variables consumed:
* string $helpContent — raw Markdown string from the DB (may be empty).
*
* Outputs nothing when $helpContent is empty or whitespace-only.
* Parsedown must already be autoloaded (it is, via bootstrap → APP_ROOT/src/).
*/
$helpContent = trim($helpContent ?? '');
if ($helpContent === '') {
return;
}
require_once APP_ROOT . '/src/Parsedown.php';
$pd = new Parsedown();
$pd->setSafeMode(true);
$html = $pd->text($helpContent);
?>
<div class="form-help-block">
<?= $html ?>
</div>
<?php
unset($helpContent, $pd, $html);