<?php 
    global $rdgb;
    $rdgb = (!empty($rdgb)) ? $rdgb : Rdg_Blocks::instance();

    $block_styles = [];
    $block_classes = [BLOCK_RDG_HEADING_PARAGRAPH];
    $block_heading_paragraph = $rdgb->settings->getBlock(BLOCK_RDG_HEADING_PARAGRAPH);

    if (!empty($block['backgroundColor'])) {
        $block_classes[] = 'has-background';
        $block_classes[] = 'has-'.$block['backgroundColor'].'-background-color';
    }

    if (!empty($block['style']['color']['background'])) {
        $block_styles[] = 'background-color: '.$block['style']['color']['background'].';';
    }

    $position_block = $rdgb->helpers->getBlocksSpaces(get_fields());

    $content = (!empty(get_field('content'))) ? get_field('content') : null;
?>

<div class="rdg-blocks">
    <div class="<?php echo esc_attr(join(' ', $block_classes)); ?>" style="<?php echo $position_block . esc_attr(join(' ', $block_styles)); ?>">
        <div class="content">
            <?php require RDGBLOCKS_PLUGIN_BLOCKS_DIR.'partials/heading.php'; ?>

            <?php if (!empty($content)): ?>
                <div class="body">
                    <?php echo $content; ?>
                </div>
            <?php else: ?>
                <div class="message">
                    <span><?php echo __('Must add some content.'); ?></span>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>
