<?php
/**
 * Displays the site header.
 *
 * @package NewsMaster
 */
?>
<?php
$enable_offcanvas = newsmaster_get_option('enable_offcanvas');

$enable_header_advertisement = newsmaster_get_option('enable_header_advertisement');
$header_advert_image = newsmaster_get_option('header_advert_image');
$header_advert_image_url = newsmaster_get_option('header_advert_image_url');
if ($enable_header_advertisement && !empty($header_advert_image)) { ?>
    <div class="wpi-header-promote header-promote-bg">
        <a href="<?php echo esc_url($header_advert_image_url); ?>" class="wpi-promote-center" target="_blank">
            <img src="<?php echo esc_url($header_advert_image); ?>">
        </a>
    </div>
<?php } ?>

<header id="masthead" class="site-header site-header-1 <?php echo has_header_image() ? 'has-header-image data-bg' : ''; ?>" <?php if (has_header_image()) { ?>data-background="<?php echo esc_url(get_header_image()); ?>"<?php } ?>>
    <?php get_template_part('template-parts/header/responsive-header'); ?>
    <div class="site-header-desktop hide-on-tablet hide-on-mobile">
        <div class="wrapper header-wrapper">
            <div class="header-components header-components-left">
                <?php if ($enable_offcanvas) { ?>
                    <button class="toggle site-drawer-menu-icon" aria-label="<?php _e('Toggle Offcanvas Menu', 'newsmaster'); ?>" tabindex="0">
                        <?php newsmaster_the_theme_svg('offcanvas'); ?>
                    </button>
                <?php } ?>
            </div>

            <div class="header-components header-components-center">
                <?php get_template_part('template-parts/header/site-branding'); ?>
            </div>

            <div class="header-components header-components-right">

                <button class="toggle nav-toggle" aria-label="<?php _e('Open Menu', 'newsmaster'); ?>" data-toggle-target=".menu-modal" data-toggle-body-class="showing-menu-modal" aria-expanded="false" data-set-focus=".close-nav-toggle">
                <span class="toggle-text"><?php _e('Menu', 'newsmaster'); ?></span>
                <span class="wpi-menu-icon">
                    <span></span>
                    <span></span>
                </span>
                </button><!-- .nav-toggle -->

                <button class="toggle search-toggle desktop-search-toggle" data-toggle-target=".search-modal" data-toggle-body-class="showing-search-modal" data-set-focus=".search-modal .search-field" aria-expanded="false">
                    <?php newsmaster_the_theme_svg('search'); ?>
                    <span class="toggle-text"><?php _e('Search', 'newsmaster'); ?></span>
                </button><!-- .search-toggle -->
            </div>
        </div>
    </div>
</header><!-- #masthead -->
