feat(main): Groups and blocks
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Websmid\CustomHtml\Form\ChoiceProvider;
|
||||
|
||||
use PrestaShop\PrestaShop\Core\Form\ConfigurableFormChoiceProviderInterface;
|
||||
use PrestaShop\PrestaShop\Core\Form\FormChoiceAttributeProviderInterface;
|
||||
use PrestaShop\PrestaShop\Core\Form\FormChoiceProviderInterface;
|
||||
use Db;
|
||||
|
||||
final class CustomHtmlGroupChoiceProvider implements
|
||||
FormChoiceProviderInterface,
|
||||
FormChoiceAttributeProviderInterface,
|
||||
ConfigurableFormChoiceProviderInterface
|
||||
{
|
||||
public function getChoices(array $options = []): array
|
||||
{
|
||||
$groups = Db::getInstance()->executeS(
|
||||
'SELECT `id_ws_customhtml_group`, `title`
|
||||
FROM `' . _DB_PREFIX_ . 'ws_customhtml_group`
|
||||
ORDER BY `title` ASC'
|
||||
);
|
||||
|
||||
$choices = [];
|
||||
|
||||
foreach ($groups as $group) {
|
||||
$choices[$group['title']] = (int) $group['id_ws_customhtml_group'];
|
||||
}
|
||||
|
||||
return $choices;
|
||||
}
|
||||
|
||||
public function getChoicesAttributes(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user