'field', 'type' => 'submit', 'label' => __( 'Submit Button', 'booking' ), 'icon' => 'wpbc_icn_check_circle', 'usage_key' => 'submit', // === Schema: coercion/validation + defaults for Inspector/serialization === 'schema' => array( 'props' => array( 'label' => array( 'type' => 'string', 'default' => __( 'Send', 'booking' ) ), 'name' => array( 'type' => 'string', 'default' => '' ), 'html_id' => array( 'type' => 'string', 'default' => '' ), 'cssclass' => array( 'type' => 'string', 'default' => 'wpbc_bfb__btn wpbc_bfb__btn--primary' ), 'help' => array( 'type' => 'string', 'default' => '' ), ), ), // === Inspector UI (Factory-driven; no WP templates here) === 'inspector_ui' => array( 'title' => __( 'Submit Button', 'booking' ), 'description' => __( 'Configure the submit button appearance and attributes.', 'booking' ), 'header_variant' => 'toolbar', 'header_actions' => array( 'deselect', 'scrollto', 'move-up', 'move-down', 'duplicate', 'delete' ), 'groups' => array( array( 'key' => 'basic', 'label' => __( 'Basic', 'booking' ), 'open' => true, 'controls' => array( array( 'type' => 'text', 'key' => 'label', 'label' => __( 'Label', 'booking' ) ), // array( 'type' => 'text', 'key' => 'name', 'label' => __( 'Name', 'booking' ) ), array( 'type' => 'textarea', 'key' => 'help', 'label' => __( 'Help text', 'booking' ), 'rows' => 3, ), ), ), array( 'key' => 'appearance', 'label' => __( 'Advanced', 'booking' ), 'controls' => array( array( 'type' => 'text', 'key' => 'cssclass', 'label' => __( 'CSS class', 'booking' ) ), array( 'type' => 'text', 'key' => 'html_id', 'label' => __( 'HTML ID', 'booking' ) ), ), ), ), ), // No templates_printer for Schema-driven variant. ); return $packs; } add_filter( 'wpbc_bfb_register_field_packs', 'wpbc_bfb_register_field_packs__field_submit_schema' ); /** * Enqueue the Submit field pack JS for the Builder page. * * This hook is fired only on the Builder page (gated by is_builder_by_request()). * * @param string $page Current admin page slug. * * @return void */ function wpbc_bfb_enqueue__field_submit_schema_js( $page ) { wp_enqueue_script( 'wpbc-bfb_field_submit_schema', wpbc_plugin_url( '/includes/page-form-builder/field-packs/submit/_out/submit.js' ), array( 'wpbc-bfb' ), WP_BK_VERSION_NUM, true ); } add_action( 'wpbc_enqueue_js_field_pack', 'wpbc_bfb_enqueue__field_submit_schema_js', 10, 1 ); /** * (Optional) Register the "Submit" palette item in "general/bottom". * * If your palette auto-builds from packs, you can remove this. * * @param string $group Palette group: 'general' | 'advanced' | ... * @param string $position Position: 'top' | 'bottom' * * @return void */ function wpbc_bfb_palette_register_items__submit_schema( $group, $position ) { if ( 'essentials' !== $group || 'bottom' !== $position ) { return; } ?>
  • submit