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