This release adds a new "USP" (Unique Selling Proposition) block type, allowing for flexible display of image-based selling points with optional links. Additionally, administrators can now assign custom CSS classes to Custom HTML Groups, enhancing layout and styling capabilities. Includes a refinement to the FAQ accordion template to ensure questions without answers do not display a collapse button, improving usability. Updates module version to 1.13.0 with a database upgrade script for the new `custom_class` column.
61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Websmid\CustomHtml\Model;
|
|
|
|
use ObjectModel;
|
|
use Db;
|
|
|
|
class CustomHtmlGroup extends ObjectModel
|
|
{
|
|
/** @var int */
|
|
public $id;
|
|
|
|
/** @var string */
|
|
public $hook_name = '';
|
|
|
|
/** @var string */
|
|
public $title = '';
|
|
|
|
/** @var string */
|
|
public $custom_class = '';
|
|
|
|
/** @var int */
|
|
public $active = 1;
|
|
|
|
/** @var int */
|
|
public $ordering = 0;
|
|
|
|
/** @var string */
|
|
public $date_add;
|
|
|
|
/** @var string */
|
|
public $date_upd;
|
|
|
|
public static $definition = [
|
|
'table' => 'ws_customhtml_group',
|
|
'primary' => 'id_ws_customhtml_group',
|
|
'fields' => [
|
|
'hook_name' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 64],
|
|
'title' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 256],
|
|
'custom_class' => ['type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => false, 'size' => 128],
|
|
'active' => ['type' => self::TYPE_BOOL, 'validate' => 'isBool'],
|
|
'ordering' => ['type' => self::TYPE_INT, 'validate' => 'isInt'],
|
|
'date_add' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
|
|
'date_upd' => ['type' => self::TYPE_DATE, 'validate' => 'isDate'],
|
|
],
|
|
];
|
|
|
|
public static function getActiveByHookName(string $hookName): array
|
|
{
|
|
$result = Db::getInstance()->executeS(
|
|
'SELECT `id_ws_customhtml_group`, `title`, `active`, `custom_class`, `ordering`
|
|
FROM `' . _DB_PREFIX_ . 'ws_customhtml_group`
|
|
WHERE `hook_name` = \'' . pSQL($hookName) . '\'
|
|
AND `active` = 1
|
|
ORDER BY `ordering` ASC'
|
|
);
|
|
|
|
return $result ?: [];
|
|
}
|
|
}
|