<?php

use App\Models\Block;

return [
    "type"           => "blocks",
    "model"          => App\Models\Block::class,
    "label"          => "Blocks",
    "label_singular" => "Block",
    "group"          => "content",
    "order"          => TRUE,
    "fields"         => [
        [
            "name"          => "title",
            "label"         => "Block Title",
            "type"          => "textBox",
            "maxLength"     => 150,
            "multiLanguage" => TRUE,
            "preValidation" => "strip_tags|xss_clean|trim",
            "validation"    => "required|max:150",
            "inList"        => TRUE,
            "search"        => TRUE,
            "sort"          => TRUE
        ],
        [
            "name"          => "type",
            "label"         => "Block Type",
            "type"          => "selectBox",
            "list"          => [
                Block::BLOCK_TYPE_SLIDER   => "Slider",
                //BLOCK::BLOCK_TYPE_LOCATION => "Location",
                BLOCK::BLOCK_TYPE_WYSIWYG  => "Editor"
            ],
            "defaultValue"  => "blockSlider",
            "preValidation" => "trim",
            "validation"    => ""
        ],
        [
            "name"          => "display_type",
            "label"         => "Display Type",
            "type"          => "selectBox",
            "list"          => Block::getDisplayTypeOptions(BLOCK::BLOCK_TYPE_WYSIWYG),
            "preValidation" => "trim",
            "validation"    => "",
            "parent"        => [
                "name"   => "type",
                "values" => [
                    BLOCK::BLOCK_TYPE_WYSIWYG
                ]
            ]
        ],
        [
            "name"          => "block_title",
            "label"         => "Title",
            "type"          => "textBox",
            "maxLength"     => 300,
            "multiLanguage" => TRUE,
            "preValidation" => "strip_tags|xss_clean|trim",
            "validation"    => "max:300",
            "inList"        => FALSE,
            "search"        => FALSE,
            "sort"          => FALSE,
            "parent"        => [
                "name"   => "type",
                "values" => [
                    BLOCK::BLOCK_TYPE_LOCATION,
                    BLOCK::BLOCK_TYPE_WYSIWYG
                ]
            ]
        ],
        [
            "name"        => "slider",
            "label"       => "Slider",
            "type"        => "multiplePicker",
            "longList"    => TRUE,
            "allowInsert" => TRUE,
            "objectTypes" => ["sliderItems"],
            "order"       => TRUE,
            "maxSize"     => 32,
            "parent"      => [
                "name"   => "type",
                "values" => [Block::BLOCK_TYPE_SLIDER]
            ]
        ],
        [
            "name"  => "location",
            "label" => "Location",
            "type"  => "location",
            "parent"      => [
                "name"   => "type",
                "values" => [BLOCK::BLOCK_TYPE_LOCATION]
            ]
        ],
        [
            "name"          => "wysiwyg",
            "label"         => "Editor",
            "type"          => "editor",
            "multiLanguage" => TRUE,
            "preValidation" => "xss_clean|trim",
            "validation"    => "",
            "parent"      => [
                "name"   => "type",
                "values" => [BLOCK::BLOCK_TYPE_WYSIWYG]
            ]
        ],
        [
            "name"          => "image",
            "label"         => "Image",
            "type"          => "mediaPicker",
            "multiple"      => FALSE,
            "mediaType"     => "image",
            "placement"     => "sidebar",
            "parent"      => [
                "name"   => "type",
                "values" => [BLOCK::BLOCK_TYPE_WYSIWYG]
            ]
        ],
    ],
    "actions"        => [
        "edit", "order", "insert", "delete"
    ]
];
