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:
@@ -42,8 +42,15 @@ test('icon card widgets expose Zibll vertical and horizontal contracts', () => {
|
||||
for (const token of ['clearfix', 'row gutters-5', 'icon-card', 'icon-cover-card', 'icon-cover-icon', 'icon-cover-desc']) {
|
||||
assert.match(renderer + helper, new RegExp(token.replace(/[.*+?^${}()|[\\]\\]/g, '\\$&')));
|
||||
}
|
||||
assert.match(helper, /wp_kses_post\(\$title\)/);
|
||||
assert.match(helper, /wp_kses_post\(\$desc\)/);
|
||||
// Card title/desc must keep legacy badge markup: fields go through the
|
||||
// shared inline whitelist (aksrt_icon_card_kses), never bare wp_kses_post
|
||||
// which strips the custom <badge> element.
|
||||
assert.match(helper, /function aksrt_icon_card_kses_tags/);
|
||||
assert.match(helper, /'badge'\s+=>\s*\['class' => true\]/);
|
||||
assert.match(helper, /aksrt_icon_card_kses\(\$title\)/);
|
||||
assert.match(helper, /aksrt_icon_card_kses\(\$desc\)/);
|
||||
assert.doesNotMatch(helper, /wp_kses_post\(\$title\)/);
|
||||
assert.doesNotMatch(helper, /wp_kses_post\(\$desc\)/);
|
||||
});
|
||||
|
||||
test('button group uses the complete Zibll schema, DOM and responsive sizing contract', () => {
|
||||
|
||||
Reference in New Issue
Block a user