mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
feat: extract MediaController, wire into Dispatcher, delete media.php
This commit is contained in:
39
app/templates/partials/form/checkbox-list.php
Normal file
39
app/templates/partials/form/checkbox-list.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Checkbox list partial — renders a group of checkboxes (e.g. languages, formats).
|
||||
*
|
||||
* The group label uses a visible <span> as the first column (matching other form
|
||||
* rows), while a <fieldset>/<legend> in the second column provides the accessible
|
||||
* grouping required by WCAG 1.3.1. The <legend> is visually hidden (sr-only) to
|
||||
* avoid duplicating the visible label text.
|
||||
*
|
||||
* Variables consumed:
|
||||
* string $name — input name attribute (will be posted as array: name[])
|
||||
* string $label — group label text
|
||||
* array $options — each element must have 'id' and 'name' keys
|
||||
* array $checked — array of 'id' values that are currently checked
|
||||
*/
|
||||
|
||||
$checked = $checked ?? [];
|
||||
?>
|
||||
<div>
|
||||
<span class="admin-row-label"><?= htmlspecialchars($label) ?></span>
|
||||
<fieldset class="admin-checkbox-group">
|
||||
<legend class="sr-only"><?= htmlspecialchars($label) ?></legend>
|
||||
<ul>
|
||||
<?php foreach ($options as $opt): ?>
|
||||
<li>
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="checkbox"
|
||||
name="<?= htmlspecialchars($name) ?>[]"
|
||||
value="<?= htmlspecialchars((string)$opt['id']) ?>"
|
||||
<?= in_array((string)$opt['id'], array_map('strval', $checked)) ? 'checked' : '' ?>>
|
||||
<?= htmlspecialchars($opt['name']) ?>
|
||||
</label>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
</div>
|
||||
<?php
|
||||
unset($checked);
|
||||
Reference in New Issue
Block a user