Automattic\WooCommerce\Internal\ShopperLists

ShopperListRenderer::render_empty_state │ public static │ WC 1.0

Empty-state <li> that the block toggles on once state.isEmpty flips. $start_hidden = true makes SSR ship with hidden so the message doesn't flash for shoppers whose list is being populated client-side. $start_hidden = false is for blocks (e.g. Wishlist) where the message should show on first paint when the list is empty.

Метод класса: ShopperListRenderer{}

Хуков нет.

Возвращает

string.

Использование

$result = ShopperListRenderer::render_empty_state( $message, $css_class, $start_hidden ): string;
$message(строка) (обязательный)
Visible empty-state message.
$css_class(строка) (обязательный)
Class attribute for the <li>.
$start_hidden(true|false)
Whether the <li> should be hidden on first paint.
По умолчанию: true

Код ShopperListRenderer::render_empty_state() WC 11.2.2

public static function render_empty_state( string $message, string $css_class, bool $start_hidden = true ): string {
	return sprintf(
		'<li class="%1$s" data-wp-bind--hidden="!state.isEmpty"%2$s>%3$s</li>',
		esc_attr( $css_class ),
		$start_hidden ? ' hidden' : '',
		esc_html( $message )
	);
}