Automattic\WooCommerce\Blocks\BlockTypes

ProductFilters::get_overlay_mode │ private │ WC 1.0

Resolve the canonical overlay mode with legacy drawer compatibility.

Method of the class: ProductFilters{}

No Hooks.

Returns

string. Overlay mode.

Usage

// private - for code of main (parent) class only
$result = $this->get_overlay_mode( $attributes );
$attributes(array) (required)
Block attributes.

ProductFilters::get_overlay_mode() code WC 11.3.0

private function get_overlay_mode( $attributes ) {
	$overlay_mode = $attributes['overlayMode'] ?? null;
	if ( in_array( $overlay_mode, array( 'off', 'mobile', 'always' ), true ) ) {
		return $overlay_mode;
	}

	return isset( $attributes['showFilterDrawer'] ) && false === $attributes['showFilterDrawer'] ? 'off' : 'mobile';
}