mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
25 lines
678 B
PHP
25 lines
678 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.
|
|
*/
|
|
|
|
$helpContent = trim($helpContent ?? '');
|
|
if ($helpContent === '') {
|
|
return;
|
|
}
|
|
|
|
$converter = new League\CommonMark\CommonMarkConverter(['html_input' => 'strip']);
|
|
$html = $converter->convert($helpContent)->getContent();
|
|
?>
|
|
<div class="student-help-block" id="help-<?= htmlspecialchars($helpKey ?? 'unknown') ?>">
|
|
<?= $html ?>
|
|
</div>
|
|
<?php
|
|
unset($helpContent, $converter, $html);
|