feat: improved layout, removed htmx-boost for simplicity
This commit is contained in:
1 parent
6730c243f6
commit
f9e7f28b6b
19 files changed
+95
-209
No files matched your search
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Form\Extension;
|
||||
|
||||
use Symfony\Component\Form\AbstractTypeExtension;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class HtmxSubmitExtension extends AbstractTypeExtension
|
||||
{
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'hx_post' => null,
|
||||
'hx_target' => '#htmx-modal',
|
||||
'hx_swap' => 'outerHTML',
|
||||
'hx_indicator' => '#loading-indicator',
|
||||
'hx_trigger' => null,
|
||||
'hx_select' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
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'],
|
||||
];
|
||||
if (null !== $options['hx_indicator']) {
|
||||
$attr['hx-indicator'] = $options['hx_indicator'];
|
||||
}
|
||||
if (null !== $options['hx_trigger']) {
|
||||
$attr['hx-trigger'] = $options['hx_trigger'];
|
||||
}
|
||||
if (null !== $options['hx_select']) {
|
||||
$attr['hx-select'] = $options['hx_select'];
|
||||
}
|
||||
$view->vars['attr'] = array_merge($view->vars['attr'], $attr);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getExtendedTypes(): iterable
|
||||
{
|
||||
return [FormType::class];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user