<?php
/**
 * Single Product tabs
 *
 * @see     https://docs.woocommerce.com/document/template-structure/
 * @package WooCommerce/Templates
 * @version 9.6.0
 */

defined( 'ABSPATH' ) || exit;

/**
 * Filter tabs and allow third parties to add their own
 * Each tab is an array containing title, callback and priority.
 *
 * @see woocommerce_default_product_tabs()
 */
$multimagazine_product_tabs = apply_filters( 'woocommerce_product_tabs', array() );

if ( ! empty( $multimagazine_product_tabs ) ) :
	$multimagazine_classes   = 'tabbed';
	$multimagazine_tab_style = get_theme_mod( 'multi_tabs_style', MULTIMAGAZINE_TABS_STYLE );
	if ( 'alternative' === $multimagazine_tab_style ) {
		$multimagazine_classes .= ' tabs-alt';
	}
	?>
	<div class="<?php echo esc_attr( $multimagazine_classes ); ?>">
		<?php foreach ( $multimagazine_product_tabs as $multimagazine_tab_id => $multimagazine_tab_data ) : ?>
			<input type="radio" name="product-radio" value="1" id="product-tab-<?php echo esc_attr( $multimagazine_tab_id ); ?>" <?php checked( 'description' === $multimagazine_tab_id, true ); ?>>
		<?php endforeach; ?>

		<ul class="woocommerce-tabs tabs">
			<?php foreach ( $multimagazine_product_tabs as $multimagazine_tab_id => $multimagazine_tab_data ) : ?>
				<li class="<?php echo esc_attr( $multimagazine_tab_id ); ?>_tab tab">
					<label for="product-tab-<?php echo esc_attr( $multimagazine_tab_id ); ?>"><?php echo wp_kses_post( apply_filters( 'woocommerce_product_' . $multimagazine_tab_id . '_tab_title', esc_html( $multimagazine_tab_data['title'] ), $multimagazine_tab_id ) ); ?></label>
				</li>
			<?php endforeach; ?>
		</ul>
		<?php foreach ( $multimagazine_product_tabs as $multimagazine_tab_id => $multimagazine_tab_data ) : ?>
			<div class="panel entry-content tab-content" id="tab-<?php echo esc_attr( $multimagazine_tab_id ); ?>">
				<?php call_user_func( $multimagazine_tab_data['callback'], $multimagazine_tab_id, $multimagazine_tab_data ); ?>
			</div>
		<?php endforeach; ?>
	</div>

	<?php do_action( 'woocommerce_product_after_tabs' ); ?>
<?php endif; ?>
