<?php
/**
 * Header Navbar (bootstrap5)
 *
 * @package digital
 * @since 1.1.0
 
 
 
 */
 
 

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

$container = get_theme_mod( 'digital_container_type' );
?>

<nav id="main-nav" class="navbar navbar-expand-md navbar-dark digitalprimary" aria-labelledby="main-nav-label" <?php digital_do_schema( 'nav' ); ?>>

	<h2 id="main-nav-label" class="screen-reader-text">
		<?php esc_html_e( 'Main Navigation', 'digital' ); ?>
	</h2>


	<div class="<?php echo esc_attr( $container ); ?>">

		<!-- Your site branding in the menu -->
		<?php 
			if(get_theme_mod('digital_header_style')=='styletwo') {
				get_template_part( 'global-templates/navbar-branding' ); 
				$msauto = 'ms-auto';
			}else {
				$msauto = '';
			}
			if(get_theme_mod('digital_header_style')=='stylethree' || get_theme_mod('digital_header_style')=='styleone' || get_theme_mod('digital_header_style')=='stylefour') { 
				$container_id ='navbarNavDropdowna';
			}else{
				$container_id ='navbarNavDropdown';
			}
			if(get_theme_mod('digital_header_style')=='stylefour' || get_theme_mod('digital_header_style')=='stylethree') { 
				$orderfirst ='navbarNavDropdowna';
			}else {
				$orderfirst = '';
			}
		?>

		<button
			class="navbar-toggler <?php echo $orderfirst; ?>"
			type="button"
			data-bs-toggle="collapse"
			data-bs-target="#<?php echo $container_id; ?>"
			aria-controls="<?php echo $container_id; ?>"
			aria-expanded="false"
			aria-label="<?php esc_attr_e( 'Toggle navigation', 'digital' ); ?>"
		>
			<span class="navbar-toggler-icon"></span>
		</button>

		<!-- The WordPress Menu goes here -->
		<?php
		wp_nav_menu(
			array(
				'theme_location'  => 'primary',
				'container_class' => 'collapse navbar-collapse',
				'container_id'    => $container_id,
				'menu_class'      => 'navbar-nav '.$msauto,
				'fallback_cb' => 'digital_primary_menu_fallback',
				'menu_id'         => 'main-menu',
				'walker'          => new digital_WP_Bootstrap_Navwalker(),
			)
		);
		?>
		
		<?php if(get_theme_mod('digital_header_style')=='stylethree') { ?>
			<div class="order-last">
				<?php echo get_search_form(); ?>
				<button class="btn" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasScrolling" aria-controls="offcanvasScrolling"><svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5"/></svg></button>
			</div>
		<?php } ?>
	</div><!-- .container(-fluid) -->

</nav><!-- #main-nav -->
