feat: admin list filtering and search

This commit is contained in:
Björn Fromme committed 2026-08-06 10:57:36 +02:00
1 parent aa8fa5c1b2
commit dd658bf9d6
41 files changed
+1977 -44

No files matched your search

+22 -8
View File
@@ -14,22 +14,36 @@ class ModalSubmitExtension extends AbstractTypeExtension
{
$resolver->setDefaults([
'hx_post' => null,
'hx_get' => null,
'hx_target' => '#htmx-modal',
'hx_swap' => 'outerHTML',
'hx_push_url' => false,
]);
}
public function buildView(FormView $view, FormInterface $form, array $options): void
{
if (null !== $options['hx_post']) {
$attr = [
'hx-post' => $options['hx_post'],
'hx-target' => $options['hx_target'],
'hx-swap' => $options['hx_swap'],
'hx-indicator' => '#htmx-modal-indicator',
];
$view->vars['attr'] = array_merge($view->vars['attr'], $attr);
// hx_post keeps the form inside the modal (so validation errors re-render in place);
// hx_get is for read-only forms such as list filters, which navigate the list instead
// and therefore usually target the body and push the resulting URL.
$method = null !== $options['hx_post'] ? 'hx-post' : (null !== $options['hx_get'] ? 'hx-get' : null);
if (null === $method) {
return;
}
$attr = [
$method => $options['hx-post' === $method ? 'hx_post' : 'hx_get'],
'hx-target' => $options['hx_target'],
'hx-swap' => $options['hx_swap'],
'hx-indicator' => '#htmx-modal-indicator',
];
if (false !== $options['hx_push_url']) {
$attr['hx-push-url'] = true === $options['hx_push_url'] ? 'true' : $options['hx_push_url'];
}
$view->vars['attr'] = array_merge($view->vars['attr'], $attr);
}
public static function getExtendedTypes(): iterable