feat(main): Add FAQ accordion

This commit is contained in:
2026-08-11 13:25:06 +02:00
parent 635c13a0ed
commit 1493081602
22 changed files with 459 additions and 4 deletions
@@ -15,7 +15,9 @@ use PrestaShop\PrestaShop\Core\Grid\Filter\Filter;
use PrestaShop\PrestaShop\Core\Grid\Filter\FilterCollection;
use PrestaShop\PrestaShop\Core\Hook\HookDispatcherInterface;
use PrestaShopBundle\Form\Admin\Type\SearchAndResetType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Websmid\CustomHtml\Config\Config;
final class CustomHtmlBlockGridDefinitionFactory extends AbstractGridDefinitionFactory
{
@@ -71,6 +73,11 @@ final class CustomHtmlBlockGridDefinitionFactory extends AbstractGridDefinitionF
->setName($this->trans('Group', [], 'Modules.Wscustomhtml.Admin'))
->setOptions(['field' => 'group_title'])
)
->add(
(new DataColumn('type'))
->setName($this->trans('Type', [], 'Modules.Wscustomhtml.Admin'))
->setOptions(['field' => 'type'])
)
->add(
(new DataColumn('active'))
->setName($this->trans('Active', [], 'Admin.Global'))
@@ -120,6 +127,15 @@ final class CustomHtmlBlockGridDefinitionFactory extends AbstractGridDefinitionF
'attr' => ['placeholder' => $this->trans('Group', [], 'Modules.Wscustomhtml.Admin')],
])
)
->add(
(new Filter('type', ChoiceType::class))
->setAssociatedColumn('type')
->setTypeOptions([
'required' => false,
'choices' => array_flip(Config::BLOCK_TYPES),
'placeholder' => $this->trans('All', [], 'Admin.Global'),
])
)
->add(
(new Filter('actions', SearchAndResetType::class))
->setAssociatedColumn('actions')
@@ -45,6 +45,7 @@ final class CustomHtmlBlockQueryBuilder extends AbstractDoctrineQueryBuilder
'wchb.`id_ws_customhtml`',
'wchb.`title`',
'wchg.`title` AS group_title',
'wchb.`type`',
'wchb.`active`',
'wchb.`ordering`',
'wchb.`date_add`'
@@ -108,6 +109,12 @@ final class CustomHtmlBlockQueryBuilder extends AbstractDoctrineQueryBuilder
continue;
}
if ($filterName === 'type') {
$qb->andWhere('wchb.`type` = :type')
->setParameter('type', pSQL($filterValue));
continue;
}
$qb->andWhere('wchb.`' . $filterName . '` LIKE :' . $filterName)
->setParameter($filterName, '%' . pSQL($filterValue) . '%');
}