'
. ''
. '' . esc_html( $label ) . ''
. rooster_icon( 'chevron-right', [ 'class' => 'rooster-account__chevron', 'width' => 20, 'height' => 20 ] )
. '';
};
$placed = [];
$body = '';
foreach ( $groups as $group ) {
$group_items = array_intersect_key( $items, array_flip( array_map( 'strval', (array) ( $group['items'] ?? [] ) ) ) );
if ( ! $group_items ) {
continue;
}
$body .= '
' . esc_html( (string) ( $group['label'] ?? '' ) ) . '';
foreach ( $group_items as $endpoint => $label ) {
$body .= $row( (string) $endpoint, (string) $label );
$placed[] = (string) $endpoint;
}
$body .= '
';
}
$rest = '';
foreach ( $items as $endpoint => $label ) {
if ( ! in_array( (string) $endpoint, $placed, true ) ) {
$rest .= $row( (string) $endpoint, (string) $label );
}
}
$wrapper = get_block_wrapper_attributes(
[
'class' => 'rooster-account-nav',
'aria-label' => __( 'Account pages', 'ai-eshop-optimizer' ),
'data-rooster-ui' => 'rooster-one/account-navigation',
]
);
AIEO_Engine_Blocks::out( sprintf( '', $wrapper, $body . $rest ) );