context['core/tabs-list'] ?? array(); if ( empty( $tabs_list ) ) { return $content; } // Re-render each tab with per-item context (index, id, label). // Match by position so items align with their corresponding tabs. $buttons_html = ''; $tab_position = 0; foreach ( $block->parsed_block['innerBlocks'] ?? array() as $parsed_tab ) { if ( 'core/tab' !== ( $parsed_tab['blockName'] ?? '' ) ) { continue; } $tab = $tabs_list[ $tab_position ] ?? null; $tab_index = $tab_position; ++$tab_position; // Skip tabs with no matching tab panel. if ( null === $tab ) { continue; } $item_context = array_merge( $block->context, array( 'core/tab-index' => $tab_index, 'core/tab-id' => $tab['id'] ?? '', 'core/tab-label' => $tab['label'] ?? '', ) ); $tab_block = new WP_Block( $parsed_tab, $item_context ); $buttons_html .= $tab_block->render(); } // Rebuild the wrapper using get_block_wrapper_attributes(). $wrapper_attributes = get_block_wrapper_attributes( array( 'role' => 'tablist' ) ); return sprintf( '