FormConfigManager lives in UTB\ProductBuilder\Data and is the single entry point for retrieving the field configuration that drives a flow’s front-end form. It follows a three-step resolution chain.
Methods
get_config(int $product_id, string $flow_id): ?array
Returns the resolved form configuration for a product, or null if no configuration can be found.
The WooCommerce product ID.
The flow’s machine identifier (e.g.
certificados_academicos).null:
Resolution chain
get_config() resolves the configuration in this order:
Product-level config (Hub way)
Reads the
_utb_form_config post meta key on the product. If it contains valid JSON, returns it immediately with id set to $product_id.Linked certificate (legacy / template)
Reads
_utb_linked_cert_id post meta. Falls back to $_GET['cert_id'] for testing. Fetches the certificate row from the database and decodes its form_config_json column.null.
Storing a product-level config
To attach a form configuration directly to a product, encode the fields array as JSON and save it to the_utb_form_config meta key:
Field object schema
Thefields array contains field definition objects. The exact shape depends on the field type, but all fields share these base properties:
Unique field identifier within the form. Becomes the key in
form_submission on the order.Field type. Common values:
text, email, tel, select, radio, checkbox, file, hidden, textarea.Human-readable label shown above the field.
Whether the field must be filled before adding to cart.
Data source key for dynamic fields (
select, radio). The flow uses this key to populate options from the configured data repository.Conditional visibility rule. When defined, the field is shown or hidden based on the value of another field.
Additional validation rules evaluated by the
RulesEngine (available since v3.0.0).Config object returned
The product ID, linked certificate ID, or
'default_flow_config' depending on which resolution step succeeded.Raw CSS injected into the product page for this form. May be empty.
Array of field definition objects (see Field object schema above).