Server IP : 192.158.238.246 / Your IP : 18.220.224.115 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/task/7779/cwd/plugins/4ecps-webforms/gutenberg-blocks/dynamic-content-blocks/ |
Upload File : |
const { __ } = wp.i18n; // Import __() from wp.i18n const { registerBlockType } = wp.blocks; registerBlockType( 'ecps/content-block', { title: __( '4ECPS - Dynamic Content Block' ), icon: 'editor-table', category: 'ecps-blocks', keywords: [ __( 'Dynamic Content Blocks' ), __( 'Dynamic Block' ), __( 'Block' ), ], attributes: { block_id: { type: 'number' } }, edit: function( props ) { const selectStyle = {fontSize: '14px', paddingRight: '5px'}; const { attributes: { block_id }, setAttributes } = props; function setBlockId( event ) { const selected = event.target.querySelector( 'option:checked' ); props.setAttributes( { block_id: Number(selected.value) } ); event.preventDefault(); } return ( <div className={ props.className }> <label style={ selectStyle } >4ECPS Block</label> <select value={ block_id } onChange={ setBlockId }> {activedemand_blocks.map(option => ( <option value={option.value}>{option.label}</option> ))} </select> </div> ); }, save: function() { return null; } } );