wp_back/wp-content/plugins/visual-portfolio/gutenberg/extensions/classic-icon-with-overlay.js
2024-05-20 15:37:46 +03:00

22 lines
565 B
JavaScript

import { addFilter } from '@wordpress/hooks';
/**
* Add overlay automatically for Classic style, when Display Icon option enabled.
*/
addFilter(
'vpf.editor.controls-on-change',
'vpf/editor/controls-on-change/classic-icon-with-overlay',
(newAttributes, control, val, attributes) => {
if (
control.name === 'items_style_default__show_icon' &&
val &&
!attributes.items_style_default__bg_color
) {
newAttributes.items_style_default__bg_color = '#000';
newAttributes.items_style_default__text_color = '#fff';
}
return newAttributes;
}
);