Automattic\WooCommerce\Internal\ShopperLists

ShopperListRenderer::render_interactivity_notices_regionpublic staticWC 1.0

Render the iAPI store-notices region used by the row-level error banners. Mirrors AddToCartWithOptions::render_interactivity_notices_region() — keep in sync if the shape changes.

Method of the class: ShopperListRenderer{}

No Hooks.

Returns

String.

Usage

$result = ShopperListRenderer::render_interactivity_notices_region( $wrapper_class ): string;
$wrapper_class(string) (required)
Class attribute for the outer <div>.

ShopperListRenderer::render_interactivity_notices_region() code WC 10.9.1

<?php
public static function render_interactivity_notices_region( string $wrapper_class ): string {
	ob_start();
	?>
	<div class="<?php echo esc_attr( $wrapper_class ); ?> wc-block-components-notices" data-wp-interactive="woocommerce/store-notices" data-wp-bind--hidden="!context.notices.length" hidden>
		<template data-wp-each--notice="context.notices" data-wp-each-key="context.notice.id">
			<div
				class="wc-block-components-notice-banner"
				data-wp-class--is-error="state.isError"
				data-wp-class--is-success="state.isSuccess"
				data-wp-class--is-info="state.isInfo"
				data-wp-class--is-dismissible="context.notice.dismissible"
				data-wp-bind--role="state.role"
				data-wp-watch="callbacks.injectIcon"
			>
				<div class="wc-block-components-notice-banner__content">
					<span data-wp-init="callbacks.renderNoticeContent" aria-live="assertive" aria-atomic="true"></span>
				</div>
				<button
					type="button"
					data-wp-bind--hidden="!context.notice.dismissible"
					class="wc-block-components-button wp-element-button wc-block-components-notice-banner__dismiss contained"
					aria-label="<?php esc_attr_e( 'Dismiss this notice', 'woocommerce' ); ?>"
					data-wp-on--click="actions.removeNotice"
				>
					<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
						<path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" />
					</svg>
				</button>
			</div>
		</template>
	</div>
	<?php
	return (string) ob_get_clean();
}