<?php
/**
 * The Sidebar widget area for header.
 *
 * @package Ruby
 */

	$header_widget_1 = is_active_sidebar( 'header-widget-1' );
	$header_widget_2 = is_active_sidebar( 'header-widget-2' );
	$header_widget_3 = is_active_sidebar( 'header-widget-3' );
	$col_md = ruby_get_flexible_columns( 'header_sidebar', array( $header_widget_1, $header_widget_2, $header_widget_3 ) );

	// If header widget areas do not have widget let's bail.
	if ( ! $col_md ) {
		return;
	}

	$enable_flex_cols = get_theme_mod( 'ruby_enable_flex_cols', 1 );

	// If we made it this far we must have widgets.
	?>
	<div class="header-widget-inner widget-area">
		<div class="container">
			<aside class="header-widget-area">
				<?php if ( $header_widget_1 || ! $enable_flex_cols  ) : ?>
				<div class="col-md-<?php echo $col_md; ?> header-widget" role="complementary">
					<?php dynamic_sidebar( 'header-widget-1' ); ?>
				</div><!-- .widget-area .first -->
				<?php endif; ?>

				<?php if ( $header_widget_2 || ! $enable_flex_cols ) : ?>
				<div class="col-md-<?php echo $col_md; ?> header-widget" role="complementary">
					<?php dynamic_sidebar( 'header-widget-2' ); ?>
				</div><!-- .widget-area .second -->
				<?php endif; ?>

				<?php if ( $header_widget_3 || ! $enable_flex_cols ) : ?>
				<div class="col-md-<?php echo $col_md; ?> header-widget" role="complementary">
					<?php dynamic_sidebar( 'header-widget-3' ); ?>
				</div><!-- .widget-area .third -->
				<?php endif; ?>
			</aside><!-- .header-widget-area -->
		</div><!-- .container -->
	</div><!-- .header-widget-inner -->