<?php
/**
 * Register theme-provided dynamic blocks from /blocks.
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

add_action( 'init', function () {
    $dir = AUDACE_DIR . '/blocks';
    if ( ! is_dir( $dir ) ) {
        return;
    }
    foreach ( glob( $dir . '/*', GLOB_ONLYDIR ) as $block_dir ) {
        if ( file_exists( $block_dir . '/block.json' ) ) {
            register_block_type( $block_dir );
        }
    }
} );
