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

	$home_widget_1 = is_active_sidebar( 'home-widget-1' );
	$home_widget_2 = is_active_sidebar( 'home-widget-2' );
	$home_widget_3 = is_active_sidebar( 'home-widget-3' );
	$col_md = ruby_get_flexible_columns( 'home_sidebar', array( $home_widget_1, $home_widget_2, $home_widget_3 ) );

	// If home 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="home-widget-inner">
		<div class="container">
			<aside class="home-widget-area widget-area">
				<?php if ( $home_widget_1 || ! $enable_flex_cols ) : ?>
				<div class="col-md-<?php echo $col_md; ?> home-widget" role="complementary">
					<?php dynamic_sidebar( 'home-widget-1' ); ?>
				</div><!-- .widget-area .first -->
				<?php endif; ?>

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

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