fix(widgets): preserve badge HTML in icon card title/desc like reference theme
wp_kses_post() strips the custom <badge> element, so icon card title/desc lost admin-authored markup (e.g. <badge class="ml6 jb-blue">GO</badge>) both at save time and render time, diverging from the reference theme which stores and echoes these fields raw. - add shared inline whitelist (aksrt_icon_card_kses_tags/aksrt_icon_card_kses) and route both card renderers plus the media-brand fallback through it - drop the dead unused $allow array in aksrt_icon_cover_card - add 'rich_html' sanitize type (FieldSchema + SchemaProvider) and mark icon card title/desc fields in widget schemas, page display schema and the page config meta box save path - align header slider card module with reference show_widget_bg branches (aksrt-panel/flex1 vs padding-10 wrapper/relative-h) - update widget contract tests to pin the whitelist behavior
This commit is contained in:
1 parent
2f571c2a98
commit
cd7082454a
9 files changed
+108
-36
No files matched your search
@@ -421,24 +421,30 @@ if (!function_exists('aksrt_header_slide')) {
|
||||
$card_count = 0;
|
||||
if (aksrt_header_slider_device_is_visible($args['header_slider_card_s'] ?? [])) {
|
||||
$card_options = wp_parse_args((array) ($args['header_slider_card_option'] ?? []), [
|
||||
'icon_radius4' => false, 'cards' => [],
|
||||
'icon_radius4' => false, 'show_widget_bg' => false, 'cards' => [],
|
||||
]);
|
||||
// legacy (Zibll): with module background the card shrinks to
|
||||
// padding-10 inside a .zib-widget wrapper (.aksrt-panel here); the
|
||||
// bg-less variant stretches each card in a .flex1 column.
|
||||
$show_bg = !empty($card_options['show_widget_bg']);
|
||||
$items = '';
|
||||
foreach ((array) $card_options['cards'] as $card) {
|
||||
if (!is_array($card) || (empty($card['icon']) && empty($card['customize_icon']) && empty($card['custom_icon']) && empty($card['icon_image']))) {
|
||||
continue;
|
||||
}
|
||||
$card['class'] = $show_bg ? 'padding-10' : 'aksrt-panel';
|
||||
$card['icon_class'] = trim((string) ($card['icon_class'] ?? '') . (!empty($card_options['icon_radius4']) ? ' radius4' : ''));
|
||||
$inner = function_exists('aksrt_icon_cover_card') ? aksrt_icon_cover_card($card) : '';
|
||||
if ($inner === '') {
|
||||
continue;
|
||||
}
|
||||
$items .= '<div class="flex1">' . $inner . '</div>';
|
||||
$items .= '<div class="' . (!$show_bg ? 'flex1' : 'relative-h') . '">' . $inner . '</div>';
|
||||
$card_count++;
|
||||
}
|
||||
if ($items !== '') {
|
||||
$cards_html = '<div class="header-slider-card container">'
|
||||
. '<div class="flex jse flex-row gutters-5 flex-col-sm-2">' . $items . '</div></div>';
|
||||
. ($show_bg ? '<div class="aksrt-panel padding-10">' : '<div class="">')
|
||||
. '<div class="flex jse flex-row gutters-5 flex-col-sm-2">' . $items . '</div></div></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user