'section', 'type' => 'section', 'label' => __( 'Section', 'booking' ), 'icon' => 'wpbc_icn_view_quilt', 'usage_key' => 'section', // Schema: add 'col_styles' as JSON string (per-column style map). 'schema' => array( 'props' => array( 'columns' => array( 'type' => 'number', 'default' => 1, 'min' => 1, 'max' => 4, 'step' => 1, ), 'cssclass' => array( 'type' => 'string', 'default' => '', ), 'html_id' => array( 'type' => 'string', 'default' => '', ), 'id' => array( 'type' => 'string', 'default' => '', ), 'label' => array( 'type' => 'string', 'default' => __( 'Section', 'booking' ), ), // NEW: Per-column flex style settings (JSON string; see JS for structure). 'col_styles' => array( 'type' => 'string', 'default' => '', ), ), ), 'templates_printer' => 'wpbc_bfb_section_wptpl_print_templates', ); return $packs; } add_filter( 'wpbc_bfb_register_field_packs', 'wpbc_bfb_register_field_packs__section_wptpl' ); /** * Enqueue the section pack JS (renderer + style inspector slot). * * @param string $page Current admin page slug. */ function wpbc_bfb_enqueue__section_wptpl_js( $page ) { if ( WPBC_BFB_BUILDER_PAGE_SLUG !== $page ) { return; } wp_enqueue_script( 'wpbc-bfb_section_wptpl', wpbc_plugin_url( '/includes/page-form-builder/field-packs/section/_out/section-wptpl.js' ), array( 'wp-util', 'wpbc-bfb' ), WP_BK_VERSION_NUM, true ); wp_enqueue_script( 'wpbc-bfb_section_column_styles', wpbc_plugin_url( '/includes/page-form-builder/field-packs/section/_out/ui-column-styles.js' ), array( 'wpbc-bfb_section_wptpl' ), WP_BK_VERSION_NUM, true ); wp_enqueue_script( 'wpbc-bfb_section_inspector_patch', wpbc_plugin_url( '/includes/page-form-builder/field-packs/section/_out/bfb-inspector-patches.js' ), array( 'wpbc-bfb_section_wptpl' ), WP_BK_VERSION_NUM, true ); } add_action( 'wpbc_enqueue_js_field_pack', 'wpbc_bfb_enqueue__section_wptpl_js', 10, 1 ); /** * wp.template() blocks. * - Adds new Inspector "Style" group with a reusable slot 'column_styles' (rendered by JS). * * @param string $page Current admin page slug. */ function wpbc_bfb_section_wptpl_print_templates( $page ) { if ( WPBC_BFB_BUILDER_PAGE_SLUG !== $page ) { return; } ?> // and inspector glue calls: // UI.wpbc_bfb_column_styles.render_for_section(builder, section_el, host) ?>
  • section