<?php

use ACFComposer\ACFComposer;

add_action('acf/init', function () {
    ACFComposer::registerFieldGroup([
        'name'   => 'reusableBlocks',
        'title'  => 'Reusable Block',
        'fields' => [
            [
                'label'        => 'Blocks',
                'name'         => 'reusable-blocks',
                'type'         => 'flexible_content',
                'button_label' => 'Add Block',
                'acfe_flexible_modal' => [
                    'acfe_flexible_modal_enabled'    => 1,
                    'acfe_flexible_modal_size'       => 'large',
                    'acfe_flexible_modal_col'        => '3',
                    'acfe_flexible_modal_categories' => 0,
                ],
                'acfe_flexible_layouts_thumbnails' => 1,
                'layouts'      => [
                    [
                        'name'       => 'image-text',
                        'label'      => 'Image & Text',
                        'display'    => 'block',
                        'acfe_flexible_thumbnail' => get_image_src('image-text-block.png'),
                        'sub_fields' => codelibry_acf_fields_image_text(),
                    ],
                    [
                        'name'       => 'testimonials',
                        'label'      => 'Testimonials',
                        'display'    => 'block',
                        'acfe_flexible_thumbnail' => get_image_src('testimonials-block.png'),
                        'sub_fields' => codelibry_acf_fields_testimonials(),
                    ],
                ],
            ],
        ],
        'location' => [
            [
                ['param' => 'post_type', 'operator' => '==', 'value' => 'reusable-blocks'],
            ],
        ],
    ]);
});
