Frontend assets
OctaForms ships exactly one JavaScript file and one stylesheet on the front end, together as one bundle. That bundle contains three things: the form helper, the callback widget, and the cron nudge. Which of them actually does anything depends on the data present on the page, not on which files load. So there is nothing to conditionally enqueue.
How the bundle loads
Section titled “How the bundle loads”- One JS file and one CSS file, always, on every front-end page.
- Loaded in the footer with the lowest execution priority, so it never gets in the way of your own scripts.
- The stylesheet is printed last and loaded asynchronously, so it does not block rendering.
- Each module inside the bundle activates only when its data is present. The helper looks for
octaFormsHelper, the callback widget foroctaFormsCallback, the cron nudge foroctaFormsCron. If the data is not there, the module stays silent.
Turning things off
Section titled “Turning things off”Everything can be switched off with a filter, and most also with an admin setting:
| What | Filter | Setting |
|---|---|---|
| The whole bundle (JS and CSS) | octa_forms_frontend_assets_enabled |
— |
| The stylesheet only | octa_forms_styles_enabled |
disable_styles |
| The helper’s automatic form scan | octa_forms_helper_autobind |
— |
| The cron nudge | octa_forms_cron_nudge_enabled |
disable_cron_nudge |
| The callback widget on a given page | octa_forms_callback_visible |
— |
A couple of these are worth explaining:
octa_forms_callback_visibleis a per-request escape hatch. Returnfalseto hide the widget on specific pages, such as a checkout. The bundle still loads; only the widget’s data and markup are left out.octa_forms_helper_autobindis developer-only, with no admin setting. Returnfalseand the helper skips its initial scan, butwindow.octaForms.attach()still works so you can bind forms yourself. See The JS helper.
To strip the plugin’s front-end code completely, use the master switch octa_forms_frontend_assets_enabled.
All of these filters are listed with their signatures in Hooks and filters.