mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
feat: extract MediaController, wire into Dispatcher, delete media.php
This commit is contained in:
33
app/templates/partials/form/file-field.php
Normal file
33
app/templates/partials/form/file-field.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* File input partial.
|
||||
*
|
||||
* Variables consumed:
|
||||
* string $name — input name attribute (used for id too unless $id set)
|
||||
* string $label — visible label text
|
||||
* string $accept — MIME types / extensions for the accept attribute (e.g. 'image/jpeg,image/png')
|
||||
* string|null $hint — optional hint shown in <small> below the input
|
||||
* bool $multiple — whether to allow multiple file selection; default false
|
||||
* string|null $id — override the id attribute (defaults to $name)
|
||||
*/
|
||||
|
||||
$accept = $accept ?? '';
|
||||
$hint = $hint ?? null;
|
||||
$multiple = $multiple ?? false;
|
||||
$id = $id ?? $name;
|
||||
?>
|
||||
<div>
|
||||
<label for="<?= htmlspecialchars($id) ?>"><?= htmlspecialchars($label) ?></label>
|
||||
<div class="admin-file-input">
|
||||
<input type="file"
|
||||
id="<?= htmlspecialchars($id) ?>"
|
||||
name="<?= htmlspecialchars($name) ?><?= $multiple ? '[]' : '' ?>"
|
||||
<?= $accept ? 'accept="' . htmlspecialchars($accept) . '"' : '' ?>
|
||||
<?= $multiple ? 'multiple' : '' ?>>
|
||||
<?php if ($hint): ?>
|
||||
<small><?= htmlspecialchars($hint) ?></small>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
unset($accept, $hint, $multiple, $id);
|
||||
Reference in New Issue
Block a user