<?php
/**
 * The template for displaying theme sidebar.
 *
 * @package     Business Interface
 * @author      WPInterface Team
 * @since       1.0.0
 */

if ( ! business_interface_is_sidebar_displayed() ) {
	return;
}

$business_interface_sidebar = business_interface_get_sidebar();
?>

<aside id="secondary" class="widget-area si-sidebar-container"<?php business_interface_schema_markup( 'sidebar' ); ?> role="complementary">

	<div class="si-sidebar-inner">
		<?php do_action( 'business_interface_before_sidebar' ); ?>

		<?php
		if ( is_active_sidebar( $business_interface_sidebar ) ) {

			dynamic_sidebar( $business_interface_sidebar );

		} elseif ( current_user_can( 'edit_theme_options' ) ) {

			$business_interface_sidebar_name = business_interface_get_sidebar_name_by_id( $business_interface_sidebar );
			?>
			<div class="interface-sidebar-widget interface-widget business-interface-no-widget">

				<div class='h4 widget-title'><?php echo esc_html( $business_interface_sidebar_name ); ?></div>

				<p class='no-widget-text'>
					<?php if ( is_customize_preview() ) { ?>
						<a href='#' class="business-interface-set-widget" data-sidebar-id="<?php echo esc_attr( $business_interface_sidebar ); ?>">
					<?php } else { ?>
						<a href='<?php echo esc_url( admin_url( 'widgets.php' ) ); ?>'>
					<?php } ?>
						<?php esc_html_e( 'Click here to assign a widget.', 'business-interface' ); ?>
					</a>
				</p>
			</div>
			<?php
		}
		?>

		<?php do_action( 'business_interface_after_sidebar' ); ?>
	</div>

</aside><!--#secondary .widget-area -->

<?php
