$sidebar ) { $sidebars[ $k ] = array( 'id' => $sidebar['id'], 'name' => $sidebar['name'], ); } } wp_localize_script( 'canvas-block-widgetized-area-editor-script', 'canvasWidgetizedBlock', array( 'sidebars' => $sidebars, ) ); } /** * Register block * * @param array $blocks all registered blocks. * @return array */ public function register_block_type( $blocks ) { $blocks[] = array( 'name' => 'canvas/widgetized-area', 'title' => esc_html__( 'Widgetized Area', 'canvas' ), 'category' => 'canvas', 'keywords' => array(), 'icon' => ' ', 'supports' => array( 'className' => true, 'anchor' => true, 'html' => false, 'canvasSpacings' => true, 'canvasBorder' => true, 'canvasResponsive' => true, ), 'styles' => array(), 'location' => array(), 'sections' => array(), 'layouts' => array(), // Set fields just for add block attributes. // Editor render for this block is custom JSX // so we don't need to render fields automatically. 'fields' => array( array( 'key' => 'area', 'type' => 'type-string', 'default' => '', ), ), 'template' => dirname( __FILE__ ) . '/block-widgetized-area/render.php', // enqueue registered scripts/styles. 'editor_script' => 'canvas-block-widgetized-area-editor-script', ); return $blocks; } } new CNVS_Block_Widgetized_Area();