applyFilters( "ignore_close_area", ignore, area, reason );
applyFilters( "ignore_close_area_{key}", ignore, area, reason );Allows to ignore the close_area request and force an area to stay open.
The dynamic part of the filter name is the sanitized Area key. See DiviAreaItem.theKey() for details.
Params
- ignore
- Whether to ignore the close_area command and keep the area visible. Default: false.
- area
- The Divi Area which will be hidden.
- reason
- Identifies the action that triggered the close_area call.
Returns
Return true to keep the Area open, or false to proceed with closing the Area.
Examples
// Remember the timestamp when the Area was made visible.
DiviArea.addAction( 'show_area', function( area ) {
    area.setData( 'opened_at', new Date().getTime() );
});
// Forces every Area to stay visible for at least 10 seconds.
DiviArea.addFilter( 'ignore_close_area', function( ignore, area, closeType ) {
    var openSince = (new Date().getTime() - area.getData( 'opened_at' )) / 1000;
    if ( openSince >= 10 ) {
        return false; // process the close-request.
    } else {
        console.log('Try again in', parseInt(10 - openSince), 'seconds');
        return true; // ignore the close-request.
    }
});Notes
This filter is applied after any close_area action was fired.
However, DiviArea.hide() will always hide the Area without calling the ignore_close_area filter!