This feature allows administrators to define custom CSS classes for individual HTML blocks. It enhances styling flexibility and integrates with common grid systems (e.g., Bootstrap `col-md-6`) by applying user-defined classes to the block's wrapper element. Includes: - A new `custom_class` field in the block model, form, and data handlers. - Database schema updates with an upgrade path to handle potential renames from `column_class`. - Frontend rendering to apply the classes. - Registration of `actionFrontControllerSetMedia` hook to load front-end CSS. - Basic responsive image styling for blocks.
33 lines
857 B
PHP
33 lines
857 B
PHP
<?php
|
|
|
|
if (!defined('_PS_VERSION_')) {
|
|
exit;
|
|
}
|
|
|
|
function upgrade_module_1_5_0($module)
|
|
{
|
|
$newColumn = Db::getInstance()->executeS(
|
|
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'custom_class\''
|
|
);
|
|
|
|
if (!empty($newColumn)) {
|
|
return true;
|
|
}
|
|
|
|
$oldColumn = Db::getInstance()->executeS(
|
|
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'column_class\''
|
|
);
|
|
|
|
if (!empty($oldColumn)) {
|
|
return Db::getInstance()->execute(
|
|
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
|
|
CHANGE `column_class` `custom_class` VARCHAR(128) NOT NULL DEFAULT \'\''
|
|
);
|
|
}
|
|
|
|
return Db::getInstance()->execute(
|
|
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
|
|
ADD COLUMN `custom_class` VARCHAR(128) NOT NULL DEFAULT \'\' AFTER `content`'
|
|
);
|
|
}
|