<?php 
    class Edumodo_Layout_hooks{
        private static $instance; 

        public static function init(){
            if( null === self::$instance ){
                self::$instance = new self;
            }
            return self::$instance;
        }
        public function __construct(){
            add_action('edumodo_layout_column_start', [$this, 'edumodo_layout_column_start_cb'], 10, 1);
            add_action('edumodo_layout_column_end', [$this, 'edumodo_layout_column_end_cb']);
            add_action('edumodo_layout_sidebar', [$this, 'edumodo_layout_sidebar_cb'], 10, 3);
        }
        
        
        public function edumodo_layout_column_start_cb( $layout_id = '' ) {
            $edumodo_layout = get_theme_mod( $layout_id );
            if( $edumodo_layout == 'right-sidebar' ) :  ?>
                <div class="col-lg-8 order-lg-first">
            <?php elseif( $edumodo_layout == 'no-sidebar' ): ?>
                <div class="col-lg-12">
            <?php elseif( $edumodo_layout == 'left-sidebar' ): ?>
                <div class="col-lg-8 order-lg-last order-first">
            <?php endif;
        }

        public function edumodo_layout_column_end_cb() { ?>
            </div>
        <?php }

        public function edumodo_layout_sidebar_cb(  $layout_id = '', $sidebar_id='', $sidebar_class='' ) {
            $edumodo_layout = get_theme_mod( $layout_id );
            if( $edumodo_layout != 'no-sidebar' ) :
            ?>
            <div class="col-lg-4 sidebar-wrapper <?php echo $sidebar_class; ?>">
                <?php dynamic_sidebar( $sidebar_id ); ?>
            </div>
            <?php
            endif;
        }
        
    }
?>