<?php

use Silvanus\includes\blocks\AcfBlockFields;

try {
    $HeroPlain = new AcfBlockFields('Hero Plain', __FILE__);
    $HeroPlain->addContainerSettings();

    // Block Fields
    $HeroPlain->addText('Main Header');
    $HeroPlain->addWysiwyg('Tag Line', ['rows' => 2]);

    $HeroPlain->addTrueFalse('overlay_header', [
        'label' => 'Sit behind header / menus',
        'ui' => 1,
        'default_value' => 0,
        'instructions' => 'If enabled, the hero will sit behind the site header (menus overlay on top).',
    ]);

    $HeroPlain->addFile('Background Video', [
        'return_format' => 'array',
        'library' => 'all',
        'mime_types' => 'mp4,webm,ogg',
        'required' => 0,
    ]);

    $HeroPlain->addImage('Background Image', [
        'return_format' => 'id',
        'preview_size' => 'large',
        'library' => 'all',
        'mime_types' => 'png,jpg,jpeg,webp',
        'required' => 0,
    ]);

    $HeroPlain->addRepeater('Buttons', ['layout' => 'block'])
        ->addLink('button', ['return_format' => 'array'])
        ->endRepeater();

    return $HeroPlain->build();
} catch (\StoutLogic\AcfBuilder\FieldNameCollisionException $e) {
    // no-op
}