Automattic\WooCommerce\Internal\ShopperLists
ShopperListRenderer::render_each_child
Wrap $row_inner_markup in an SSR <li data-wp-each-child> element seeded with the per-row iAPI context derived from $item. iAPI's hydration treats this as a no-op diff against the <template> if the inner markup matches.
Trust contract: caller is responsible for ensuring $row_inner_markup contains only safe, escaped HTML.
Method of the class: ShopperListRenderer{}
No Hooks.
Returns
String.
Usage
$result = ShopperListRenderer::render_each_child( $item, $row_inner_markup ): string;
- $item(array) (required)
- .
- $row_inner_markup(string) (required)
- Inner markup for the
<li>.
ShopperListRenderer::render_each_child() ShopperListRenderer::render each child code WC 10.9.1
public static function render_each_child( array $item, string $row_inner_markup ): string {
$context = array( 'listItem' => $item );
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- wp_interactivity_data_wp_context() returns a safely-encoded attribute pair; $row_inner_markup is composed of escaped fragments from the section helpers below.
return sprintf(
'<li class="%1$s" data-wp-each-child %2$s>%3$s</li>',
esc_attr( self::ROW_CLASS ),
wp_interactivity_data_wp_context( $context ),
$row_inner_markup
);
}