<?php
/**
 * The template to display custom header from the ThemeREX Addons Layouts
 *
 * @package HYGIA
 * @since HYGIA 1.0.06
 */

$hygia_header_css   = '';
$hygia_header_image = get_header_image();
$hygia_header_video = hygia_get_header_video();
if ( ! empty( $hygia_header_image ) && hygia_trx_addons_featured_image_override( is_singular() || hygia_storage_isset( 'blog_archive' ) || is_category() ) ) {
	$hygia_header_image = hygia_get_current_mode_image( $hygia_header_image );
}

$hygia_header_id = hygia_get_custom_header_id();
$hygia_header_meta = get_post_meta( $hygia_header_id, 'trx_addons_options', true );
if ( ! empty( $hygia_header_meta['margin'] ) ) {
	hygia_add_inline_css( sprintf( '.page_content_wrap.page_content_wrap_custom_header_margin{padding-top:%s}', esc_attr( hygia_prepare_css_value( $hygia_header_meta['margin'] ) ) ) );
}

?><header class="top_panel top_panel_custom top_panel_custom_<?php echo esc_attr( $hygia_header_id ); ?> top_panel_custom_<?php echo esc_attr( sanitize_title( get_the_title( $hygia_header_id ) ) ); ?>
				<?php
				echo ! empty( $hygia_header_image ) || ! empty( $hygia_header_video )
					? ' with_bg_image'
					: ' without_bg_image';
				if ( '' != $hygia_header_video ) {
					echo ' with_bg_video';
				}
				if ( '' != $hygia_header_image ) {
					echo ' ' . esc_attr( hygia_add_inline_css_class( 'background-image: url(' . esc_url( $hygia_header_image ) . ');' ) );
				}
				if ( is_single() && has_post_thumbnail() ) {
					echo ' with_featured_image';
				}
				if ( hygia_is_on( hygia_get_theme_option( 'header_fullheight' ) ) ) {
					echo ' header_fullheight hygia-full-height';
				}
				$hygia_header_scheme = hygia_get_theme_option( 'header_scheme' );
				if ( ! empty( $hygia_header_scheme ) && ! hygia_is_inherit( $hygia_header_scheme  ) ) {
					echo ' scheme_' . esc_attr( $hygia_header_scheme );
				}
				?>
">
	<?php

	// Background video
	if ( ! empty( $hygia_header_video ) ) {
		get_template_part( apply_filters( 'hygia_filter_get_template_part', 'templates/header-video' ) );
	}

	// Custom header's layout
	do_action( 'hygia_action_show_layout', $hygia_header_id );

	// Header widgets area
	get_template_part( apply_filters( 'hygia_filter_get_template_part', 'templates/header-widgets' ) );

	?>
</header>
