feat(main): Groups and blocks
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Websmid\CustomHtml\Form\DataProvider;
|
||||
|
||||
use PrestaShop\PrestaShop\Core\Form\IdentifiableObject\DataProvider\FormDataProviderInterface;
|
||||
use Websmid\CustomHtml\Model\CustomHtmlGroup;
|
||||
use Validate;
|
||||
|
||||
final class CustomHtmlGroupDataProvider implements FormDataProviderInterface
|
||||
{
|
||||
public function getData($id)
|
||||
{
|
||||
$group = new CustomHtmlGroup((int) $id);
|
||||
|
||||
if (!Validate::isLoadedObject($group)) {
|
||||
return $this->getDefaultData();
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => $group->title,
|
||||
'hook_name' => $group->hook_name,
|
||||
'active' => (bool) $group->active,
|
||||
];
|
||||
}
|
||||
|
||||
public function getDefaultData()
|
||||
{
|
||||
return [
|
||||
'title' => '',
|
||||
'hook_name' => '',
|
||||
'active' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user