doAction( “before_hide_area” )

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

Fires before an Area is hidden. The second parameter notifies the callback about Areas that will also be hidden together with this Area.

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 hidden.
hideAreas
(array, required) List of Area IDs that will be hidden before the current Area is hidden.

Examples

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

Notes

The hideAreas array is always empty, but you can manipulate it, if you want to hide/not hide certain Areas before the new Area is opened. It’s present in the action for consistency with the before_show_area action.

Was this article helpful?

Related Articles