mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-07 03:29:19 +02:00
add form help blocks: DB table, admin editor, live rendering in partage form
This commit is contained in:
@@ -2,14 +2,13 @@
|
||||
<h1>Contenus</h1>
|
||||
|
||||
<?php
|
||||
$flashSuccess = App::consumeFlash('success');
|
||||
$flashError = App::consumeFlash('error');
|
||||
$flash = App::consumeFlash();
|
||||
?>
|
||||
<?php if ($flashSuccess): ?>
|
||||
<div class="flash-success" role="alert"><?= htmlspecialchars($flashSuccess) ?></div>
|
||||
<?php if ($flash['success']): ?>
|
||||
<div class="flash-success" role="alert"><?= htmlspecialchars($flash['success']) ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($flashError): ?>
|
||||
<div class="flash-error" role="alert"><?= htmlspecialchars($flashError) ?></div>
|
||||
<?php if ($flash['error']): ?>
|
||||
<div class="flash-error" role="alert"><?= htmlspecialchars($flash['error']) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h2>Pages statiques</h2>
|
||||
|
||||
26
app/templates/partials/form/form-help-block.php
Normal file
26
app/templates/partials/form/form-help-block.php
Normal 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);
|
||||
Reference in New Issue
Block a user