<?php


use Silvanus\includes\blocks\AcfBlockFields;

try {
    $block = new AcfBlockFields('Single Image Block', __FILE__);

    $block->addContainerSettings();
    $block->addImage('image', [
        'required' => 1,
        'return_format' => 'id',
        'preview_size' => 'medium',
        'library' => 'all',
        'mime_types' => 'jpg,jpeg,png,gif,webp,svg',
    ]);

    $block->addChoiceField('position', 'select', [
        'choices' => [
            'left' => 'Left',
            'right' => 'Right',
            'center' => 'Center',
            'full' => 'Full Width',
        ],
        'default_value' => 'full',
        'instructions' => 'Choose how the image should align in the block.',
    ]);

    $block->addTextarea('description', [
        'rows' => 3,
        'new_lines' => 'br',
        'instructions' => 'Optional citation-style description shown beneath the image.',
    ]);

    return $block->build();

} catch (\StoutLogic\AcfBuilder\FieldNameCollisionException $e) {

}
