Gravity Forms support
Chisel includes a lightweight integration with Gravity Forms focusing on conditional styling, safe rendering helpers, and editor (block) compatibility.
Overview
- Plugin guard: All features auto‑disable if GF is inactive.
Source:Chisel\Helper\GravityFormsHelpers::is_gf_active() - Default frontend style: Forces GF’s “Gravity Theme” on frontend to align with theme styles.
Source:inc/Plugin/GravityForms.php::default_form_styles() - Removes GF reset CSS: Avoids CSS conflicts.
Source:inc/Plugin/GravityForms.php::deregister_scripts() - Conditional theme styles: Registers theme handle
gravity-formsand enqueues it only on pages containing the GF block.
Source:inc/Plugin/GravityForms.php::register_custom_styles(), enqueue_custom_styles()
Assets and styling
- Registered handle:
gravity-formsviachisel_frontend_footer_styles(footer, to keep critical path lean).
Source:inc/Plugin/GravityForms.php::register_custom_styles() - Conditional enqueue: Filter:
chisel_enqueue_frontend_footer_stylecheckshas_block('gravityforms/form', $post).
Source:inc/Plugin/GravityForms.php::enqueue_custom_styles() - Removed styles: Dequeues
gforms_reset_css.
Source:inc/Plugin/GravityForms.php::deregister_scripts() - Theme form styles: Base form styles live under
src/styles/elements/_form.scss(augment GF’s Gravity Theme).
Helper API (inc/Helper/GravityFormsHelpers.php)
- is_gf_active() : bool
Safe check for GF availability. - get_forms_list() : array
Returns[id => title]of available forms (viaGFAPI::get_forms()). Useful for populating select fields (e.g., ACF). - get_form(formId, displayTitle=false, displayDesc=false, displayInactive=false, fieldValues=null, ajax=true, tabindex=0, echo=false)
Safe wrapper forgravity_form(). Returnsnullif GF is missing.
Editor and rendering
- Gutenberg block: Use the native “Gravity Forms” block for most use cases; theme styles are enqueued automatically if the block exists on the page.
- Manual rendering: Use
GravityFormsHelpers::get_form()when you need to render a form from PHP (e.g., in custom templates that aren’t block‑based). AJAX is enabled by default in the helper.