Action and Filter Reference

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. Action and Filter Reference

The JS API uses a hook-system that is very similar to the WordPress PHP actions and filters. To learn more about hooking into those events, see the documentation about addiction() and addFilter().

Plugin Init

Here is a list of actions and filters in the order that they happen during a front end page visit.

Filterinit_optionsPlugin options were parsed and sanitized
ActionloadThe JS API is loaded and starts to initialize all Areas
ActionreadyThe JS API is fully initialized and all Areas were registered
Actionarea_wrap
area_wrap_{id}
Fires after the outer wrap of an area was created
Actionarea_close_button
area_close_button_{id}
Allows customization of the default close button
Actioninit_area
init_area_{id}
An Area was registered and is ready to be displayed
Actionrefresh_area
refresh_area_{id}
Fired after options were applied to the area element
Actioninit_overlayFired once the background overlay is initialized

User Interaction

Those hooks are fired based on user events and interaction:

Actionexit_intentThe mouse moved upwards, outside the window
Actionclick_overlayClick on the background overlay detected
Filterignore_overlay_clickReturn true to manually ignore the background click
Filterignore_esc_keyReturn true to manually ignore an Escape-keypress

Show Area

Those hooks are fired when a hidden Area is displayed:

Actionbefore_show_area
before_show_area_{id}
Fired before the Area is displayed
Actiondisabled_scrollingScrolling of the document was disabled
Actionshow_overlayThe background overlay is displayed
Actionshow_area
show_area_{id}
The Area is visible or the intro-animation has started
Actionfocus_area
focus_area_{id}
Fired after event handlers were attached to the Area
Filterreorder_areasFilters the z-index of all visible areas

Close Area

Those hooks are fired when a visible Area is hidden again:

Actionclose_area
close_area_{id}
Internal instruction to close an Area
Filterignore_close_area
ignore_close_area_{id}
Ignore the close instruction by returning true
Actionbefore_hide_area
before_hide_area_{id}
Fired before the Area is hidden
Actionblur_area
blur_area_{id}
Fired after event handlers were removed from the Area
Actionhide_area
hide_area_{id}
The Area is hidden
Actionenabled_scrollingScrolling of the document was enabled again
Actionhide_overlayThe background overlay was removed from the DOM

Internal Hooks

Filterget_data
get_data_{key}
Read data from the browsers localStorage (or cookie)
Filterset_data
set_data_{key}
Write data to the browsers localStorage (or cookie)
Filterset_data_expire
set_data_expire_{key}
Set expiration for the localStorage data (or cookie)
Filterget_option_{key}Get an option value from DiviAreaConfig

Notes

This reference is working since JS API version 1.2.0 – to find the JS API version, type in DiviArea.version in your browser console.

Was this article helpful?

Related Content

Related Articles