<?php
/**
 * CPT sections template.
 *
 * @package WLC_Algolia
 *
 * @var array  $sections Sections.
 * @var array  $cpt_default_fields Default Fields.
 * @var string $current_section Current Section.
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

( static function ( array $wlc_algolia_scope_vars ) {
	extract( $wlc_algolia_scope_vars, EXTR_SKIP ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract

$array_keys = array_keys( $sections );//phpcs:ignore

	?>
<ul class="sections" data-tab="<?php echo esc_attr( $current_section );//phpcs:ignore ?>">
<?php foreach ( $sections as $id => $label ) ://phpcs:ignore ?>
		<?php
		$url   = admin_url( 'admin.php?page=wlc-algolia&tab=cpt&section=' . sanitize_title( $id ) );//phpcs:ignore
		$class = ( $current_section === $id ? 'current' : '' );//phpcs:ignore
		$text  = esc_html( $label );//phpcs:ignore
		?>
	<li><a href="<?php echo esc_url( $url ); ?>" class="<?php echo esc_attr( $class ); ?>"><?php echo $text; ?></a></li><?php //phpcs:ignore ?>
		<?php endforeach; ?>
</ul><br class="clear" />

	<?php
} )( get_defined_vars() );
