Clanbite JavaScript Since 1.5.0

wp.hooks.applyFilters( 'clanbite.toasts.container', HTMLElement parent, string position )

Filters the element the toast stacks are added to (default document.body).

Checked every time a toast is shown, and an existing stack is moved when the answer changes, so you can return a dialog or full-screen element only while it is open. Return another element when toasts must live inside something else, for example a dialog that makes the rest of the page inert.

Filter JavaScript

Parameters

$parent (HTMLElement)

Default parent.

$position (string)

The stack's position slug.

Example

wp.hooks.addFilter( 'clanbite.toasts.container', 'my-plugin/handler', function ( parent, position ) {
	return parent;
} );

Defined in assets/js/clanbite-toasts.js

Changelog

VersionDescription
1.5.0Introduced.