feat(main): Add custom CSS classes to HTML blocks
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.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
if (!defined('_PS_VERSION_')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
function upgrade_module_1_3_0($module)
|
||||
{
|
||||
$columns = Db::getInstance()->executeS(
|
||||
'SHOW COLUMNS FROM `' . _DB_PREFIX_ . 'ws_customhtml` LIKE \'column_class\''
|
||||
);
|
||||
|
||||
if (empty($columns)) {
|
||||
if (!Db::getInstance()->execute(
|
||||
'ALTER TABLE `' . _DB_PREFIX_ . 'ws_customhtml`
|
||||
ADD COLUMN `column_class` VARCHAR(128) NOT NULL DEFAULT \'col-12\' AFTER `content`'
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user