mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
28 lines
741 B
PHP
28 lines
741 B
PHP
<?php
|
|
/**
|
|
* Renders a single form help block as HTML.
|
|
*
|
|
* Variables consumed:
|
|
* string $helpContent — raw Markdown string from the DB (may be empty).
|
|
* string $helpKey — block key, used as element id.
|
|
*
|
|
* 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="student-help-block" id="help-<?= htmlspecialchars($helpKey ?? 'unknown') ?>">
|
|
<?= $html ?>
|
|
</div>
|
|
<?php
|
|
unset($helpContent, $pd, $html);
|