<?php
/**
 * BW Step Layout Block - ACF Implementation
 */

// Include ACF Fields
require_once __DIR__ . '/acf-fields.php';

// Register ACF Block
function bw_register_step_layout_acf_block() {
    // Check if ACF function exists
    if( function_exists('acf_register_block_type') ) {
        
        // Register the block
        acf_register_block_type(array(
            'name'              => 'bw-step-layout',
            'title'             => __('BW Step Layout'),
            'description'       => __('A responsive step layout block with three cards.'),
            'render_template'   => get_stylesheet_directory() . '/blocks/bw-step-layout/template.php',
            'category'          => 'design',
            'icon'              => 'layout',
            'keywords'          => array( 'step', 'layout', 'cards', 'bw', 'stepped' ),
            'mode'              => 'preview',
            'supports'          => array(
                'align' => array('wide', 'full'),
                'mode' => true,
                'multiple' => true,
                'jsx' => true,
            ),
            'enqueue_style'     => get_stylesheet_directory_uri() . '/blocks/bw-step-layout/style-index.css',
            'example'           => array(
                'attributes' => array(
                    'mode' => 'preview',
                    'data' => array(
                        'step_direction' => 'low-to-high',
                    )
                )
            )
        ));
    }
}
add_action('acf/init', 'bw_register_step_layout_acf_block');