<?php
$bloc_option_img = $bloc['position_img'];
$bloc_img = $bloc['image'];
$bloc_bg = $bloc['txt_bg'];
$bloc_color = 'black';
switch ($bloc_bg){
    case 'beige':
    $bloc_color = 'brown';
        $bg = 'beige';
    break;
    case 'marron':
        $bloc_color = 'white';
        $bg = 'brown';
        break;
    case 'blanc':
        $bloc_color = 'brown';
        $bg = 'white';
        break;
    case 'creme':
        $bloc_color = 'brown';
        $bg = 'cream1';
        break;
}
if($bloc_option_img=='left'){
    $order1 = 'order-2 offset-xl-4';
    $order2 = 'order-1';
    $container_class = 'left_container offset-xl-2';
}else{
    $order1 = 'order-1 offset-xl-2 ';
    $order2 = 'order-2';
    $container_class = 'right_container';
}
switch ($bloc['txt_width']){
    case '100':
        $col_txt_class = 'col-xxl-12';
        break;
    case '60':
        $col_txt_class = 'col-xxl-6 offset-xxl-1';
        break;
    default:
        $col_txt_class = 'col-xxl-9 offset-xxl-1';
        break;
}
?>

<div class="container-fluid edito_part edito_part_content">
    <div class="row">
        <div class="col-12 col-xl-10 p-5 bg-<?php echo $bg;?>  <?php echo $container_class;?>">
            <div class="row">
                <div class="col-12 col-md-8 col-lg-6 col-xl-6 py-5 d-flex align-items-center <?php echo $order1;?>">
                    <div>
                        <h2 class="h2 <?php echo $bloc_color;?>"><?php echo $bloc['title']; ?></h2>
                        <p class="text-center d-block d-md-none">
                        <img src="<?php echo $bloc_img['sizes']['large'];?>" class="img-fluid mb-3 mb-md-0" alt="<?php echo $bloc_img['alt'];?>">
                        </p>
                        <div class="row">
                            <div class="col-12 <?php echo $col_txt_class;?>  py-2 py-md-5  ">
                                <div class="post_content <?php echo $bloc_color;?> p-2 p-md-5">
                                    <?php
                                    echo $bloc['txt'];
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-12 col-md-4 col-lg-6 col-xl-3 offset-xl-1 edito_img py-2 py-md-5 <?php echo $order2;?>">
                    <img src="<?php echo $bloc_img['sizes']['large'];?>" class="img-fluid mb-3 mb-md-0 d-none d-md-inline" alt="<?php echo $bloc_img['alt'];?>">
                </div>
            </div>
        </div>
    </div>
</div>

