Every field goes through FORMFORGE_Field_Types::render( $field ). This static method reads $field['type'] and dispatches to the appropriate renderer.
Rendering Lifecycle
render()is called with the field definition array- Common attributes are computed (name, id, required, placeholder)
- The type-specific renderer produces the inner HTML
- The field is wrapped in a
div, with the label before the control and the description after it - For the payment, repeater and calculation fields, the body of the field comes from the
formforge/render_field_bodyfilter; no filter receives the HTML of a single field, and theformforge/render_form_bodyfilter receives the HTML of all the fields of the form together
Generated HTML Structure
html
<div class="formforge-field formforge-field--text" data-field-id="field_1">
<label class="formforge-label" for="formforge_field_field_1" data-ff-style-target="label">Full Name<span class="formforge-required">*</span></label>
<input type="text" name="formforge_field_field_1" id="formforge_field_field_1" value="" placeholder="John Doe" class="formforge-input" data-ff-style-target="control" minlength="2" maxlength="100" required>
<p class="formforge-description" data-ff-style-target="description">Enter your full name</p>
</div>Conditional Asset Loading
Forms load CSS/JS only when detected on the current page. Specialized assets (maps, Stripe, conversational) are loaded only when the form uses those features:
php
// Map field: loaded only for a form with a map_address field and a map key saved in the settings.
// The provider script comes first (formforge-yandex-maps with the Yandex provider), then the script of the field.
if ( $has_map && $api_key ) {
wp_enqueue_script( 'formforge-google-maps', 'https://maps.googleapis.com/maps/api/js?key=' . urlencode( $api_key ) . '&libraries=places', [], FORMFORGE_VERSION, true );
wp_enqueue_script( 'formforge-map-field', FORMFORGE_URL . 'assets/js/map-field.js', [ 'formforge-frontend' ], $map_version, true );
}
// Payment field (Fillin Forge Pro): loaded only for a form with a payment field and the Stripe publishable key of the current mode (test or live) saved.
// Stripe.js comes first, then the script of the field.
if ( $has_payment && $pub_key ) {
wp_enqueue_script( 'stripe-js', 'https://js.stripe.com/v3/', [], FORMFORGE_PRO_VERSION, true );
wp_enqueue_script( 'formforge-stripe-field', FORMFORGE_PRO_URL . 'assets/js/stripe-field.js', [ 'stripe-js', 'formforge-frontend' ], $stripe_js_version, true );
}—