doAction( “before_show_area” )

  1. Home
  2. Knowledge Base
  3. Codex
  4. JS API
  5. JS Actions
  6. doAction( “before_show_area” )
doAction( "before_show_area", area, hideAreas );
doAction( "before_show_area_{key}", area, hideAreas );

Fires before an Area is displayed. The second parameter notifies the callback about Areas that will be hidden before the new Area is displayed.

The dynamic part of the filter name is the sanitized Area key. See DiviAreaItem.theKey() for details.

Params

area
(DiviAreaItem, required) The Area which will be displayed
hideAreas
(array, required) List of Area IDs that will be hidden before the new Area is displayed.

Examples

// Save a Cookie/localStorage detail when an Area is displayed.
DiviArea.addAction( 'before_show_area', function( area, hideIds ) {
    var key = area.getKey() + '_state';
    DiviArea.Utils.setLocalData( key, 'open' );
});

Notes

The parameter hideAreas can only contain values, when a Popup configuration is set to “Close other Popups: YES” . It informs the callback about any Popup that is about to be closed.

You can also manipulate the hideAreas array if you want to hide/not hide certain Areas before the new Area is opened.

Was this article helpful?

Related Articles