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
@@ -4,6 +4,7 @@ namespace Websmid\CustomHtml\Form\DataProvider;
use PrestaShop\PrestaShop\Core\Form\IdentifiableObject\DataProvider\FormDataProviderInterface;
use Websmid\CustomHtml\Model\CustomHtmlBlock;
use Websmid\CustomHtml\Model\CustomHtmlFaq;
use Validate;
final class CustomHtmlBlockDataProvider implements FormDataProviderInterface
@@ -19,8 +20,10 @@ final class CustomHtmlBlockDataProvider implements FormDataProviderInterface
return [
'id_ws_customhtml_group' => (int) $block->id_ws_customhtml_group,
'title' => $block->title,
'type' => $block->type,
'show_title' => (bool) $block->show_title,
'content' => $block->content,
'faqs' => $this->loadFaqs((int) $id),
'active' => (bool) $block->active,
];
}
@@ -30,9 +33,21 @@ final class CustomHtmlBlockDataProvider implements FormDataProviderInterface
return [
'id_ws_customhtml_group' => 0,
'title' => '',
'type' => 'html',
'show_title' => false,
'content' => '',
'faqs' => [],
'active' => true,
];
}
private function loadFaqs(int $idBlock): array
{
return array_map(static function (array $faq) {
return [
'question' => $faq['question'],
'answer' => $faq['answer'],
];
}, CustomHtmlFaq::getByBlockId($idBlock));
}
}