Server IP : 104.21.14.103 / Your IP : 3.135.203.142 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/www/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/blocks/product-new/ |
Upload File : |
/** * External dependencies */ import { __ } from '@wordpress/i18n'; import { createBlock, registerBlockType } from '@wordpress/blocks'; import { without } from 'lodash'; import { Icon, exclamation } from '@woocommerce/icons'; /** * Internal dependencies */ import Block from './block'; import { deprecatedConvertToShortcode } from '../../utils/deprecations'; import sharedAttributes, { sharedAttributeBlockTypes, } from '../../utils/shared-attributes'; registerBlockType( 'woocommerce/product-new', { title: __( 'Newest Products', 'woocommerce' ), icon: { src: <Icon srcElement={ exclamation } />, foreground: '#96588a', }, category: 'woocommerce', keywords: [ __( 'WooCommerce', 'woocommerce' ) ], description: __( 'Display a grid of your newest products.', 'woocommerce' ), supports: { align: [ 'wide', 'full' ], html: false, }, attributes: { ...sharedAttributes, }, example: { attributes: { isPreview: true, }, }, transforms: { from: [ { type: 'block', blocks: without( sharedAttributeBlockTypes, 'woocommerce/product-new' ), transform: ( attributes ) => createBlock( 'woocommerce/product-new', attributes ), }, ], }, deprecated: [ { // Deprecate shortcode save method in favor of dynamic rendering. attributes: sharedAttributes, save: deprecatedConvertToShortcode( 'woocommerce/product-new' ), }, ], /** * Renders and manages the block. * * @param {Object} props Props to pass to block. */ edit( props ) { return <Block { ...props } />; }, save() { return null; }, } );