wp_back/wp-content/plugins/visual-portfolio/gutenberg/block/variations.js

23 lines
687 B
JavaScript
Raw Normal View History

2024-05-20 15:37:46 +03:00
import { RawHTML } from '@wordpress/element';
const { controls: registeredControls } = window.VPGutenbergVariables;
export default Object.keys(registeredControls.layout.options).map((name) => {
const data = registeredControls.layout.options[name];
return {
// If we don't set the isDefault, our main block will be visible in inserter.
// Sometimes users requested this as they are confused it first start.
// isDefault: registeredControls.layout.default === data.value,
name: data.value,
attributes: { layout: data.value },
title: data.title,
icon: data.icon
? {
foreground: '#2540CC',
src: <RawHTML>{data.icon}</RawHTML>,
}
: null,
};
}) || [];