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
- The Area which will be displayed
hideAreas
- 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.