Skip to content

JS Hooks

Sasha Ivanenko edited this page Jan 19, 2023 · 4 revisions

They work only after the release of JetFormBuilder 3.0.

Table of Contents

Usage example

Internal JetFormBuilder hooks work with wp-hooks package

const {
	      addAction,
	      addFilter,
      } = JetPlugins.hooks;

addAction(
	'jet.fb.some.action',
	'my-plugin/my-function',
	function ( input ) {
		// any code
	},
);

addFilter(
	'jet.fb.some.filter',
	'my-plugin/my-function',
	function ( input ) {
		// some changes with `input`

		// we must return the input
		return input;
	}
);

Actions

jet.fb.observe.before

Runs before processing the entire DOM inside the form or repeater element.

Parameters

Source

https://github.com/Crocoblock/jetformbuilder/blob/dev/custom-render-states/assets/src/frontend/main/Observable.js#L60

jet.fb.observe.after

Runs after processing the entire DOM inside the form or repeater element.

Parameters

Source

https://github.com/Crocoblock/jetformbuilder/blob/dev/custom-render-states/assets/src/frontend/main/Observable.js#L79

jet.fb.input.makeReactive

It is executed every time after initialization of any field.

Parameters

Source

https://github.com/Crocoblock/jetformbuilder/blob/dev/custom-render-states/assets/src/frontend/main/inputs/InputData.js#L81

Filters

jet.fb.inputs

Filters the set of objects that will work with each field in the form, depending on its type and settings. Each individual object is the main control element of the field behavior

Parameters

Source

https://github.com/Crocoblock/jetformbuilder/blob/dev/custom-render-states/assets/src/frontend/main/inputs/functions.js#L19-L33

jet.fb.signals

Filters the set of objects that will work with each field in the form, depending on its type and settings. Each individual object is responsible for the changes in the DOM that should occur after the field value is updated.

Parameters

Source

https://github.com/Crocoblock/jetformbuilder/blob/dev/custom-render-states/assets/src/frontend/main/signals/functions.js#L13-L24

Useful links

🔸 View source of current page