<?php

    return [
        "type"           => "blocks",
        "model"          => "Block",
        "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"          => [
                    "blockMainArticle"                   => "Main Article",
                    "blockAudio"                         => "Audio",
                    "blockQuizz"                         => "Quizz",
                    "blockListItems"                     => "List Items",
                    "blockTitleDescription"              => "Title Description",
                    "blockTitleDescriptionSubtitleAudio" => "Title Description Subtitle Audio"
                ],
                "defaultValue"  => "blockMainArticle",
                "preValidation" => "trim",
                "validation"    => "",
                "placement"     => "sidebar"
            ],
            [
                "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" => [
                        "blockMainArticle",
                        "blockAudio",
                        "blockListItems",
                        "blockTitleDescription",
                        "blockTitleDescriptionSubtitleAudio"
                    ]
                ]
            ],
            [
                "name"          => "block_subtitle",
                "label"         => "Subtitle",
                "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" => ["blockListItems", "blockTitleDescriptionSubtitleAudio"]
                ]
            ],
            [
                "name"          => "block_description",
                "label"         => "Description",
                "type"          => "textArea",
                "maxLength"     => 1200,
                "multiLanguage" => TRUE,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "max:1200",
                "inList"        => FALSE,
                "search"        => FALSE,
                "sort"          => FALSE,
                "parent"        => [
                    "name"   => "type",
                    "values" => [
                        "blockMainArticle",
                        "blockListItems",
                        "blockTitleDescription",
                        "blockTitleDescriptionSubtitleAudio"
                    ]
                ]
            ],
            [
                "name"      => "blockImage",
                "label"     => "Image",
                "type"      => "mediaPicker",
                "multiple"  => FALSE,
                "mediaType" => "image",
                "placement" => "sidebar",
                "parent"    => [
                    "name"   => "type",
                    "values" => []
                ]
            ],
            [
                "name"          => "block_audio",
                "label"         => "Audio Url",
                "type"          => "textBox",
                "maxLength"     => 300,
                "multiLanguage" => FALSE,
                "preValidation" => "strip_tags|xss_clean|trim",
                "validation"    => "max:300",
                "placement"     => "sidebar",
                "inList"        => FALSE,
                "search"        => TRUE,
                "parent"        => [
                    "name"   => "type",
                    "values" => [
                        "blockMainArticle",
                        "blockAudio",
                        "blockListItems",
                        "blockTitleDescriptionSubtitleAudio"
                    ]
                ],
            ],
            [
                "name"          => "blockGallery",
                "label"         => "Gallery",
                "type"          => "mediaPicker",
                "multiLanguage" => FALSE,
                "mediaType"     => [
                    'image'
                ],
                "multiple"      => TRUE,
                "minSize"       => "0",
                "maxSize"       => "15",
                "parent"        => [
                    "name"   => "type",
                    "values" => ["blockMainArticle"]
                ]
            ],
            [
                "name"        => "quizzQuestions",
                "label"       => "Questions",
                "type"        => "multiplePicker",
                "longList"    => TRUE,
                "allowInsert" => TRUE,
                "objectTypes" => ["quizz_questions"],
                "order"       => TRUE,
                "minSize"     => 1,
                "parent"      => [
                    "name"   => "type",
                    "values" => ["blockQuizz"]
                ]
            ],
            [
                "name"        => "listItems",
                "label"       => "List Items",
                "type"        => "multiplePicker",
                "longList"    => TRUE,
                "allowInsert" => TRUE,
                "objectTypes" => ["list_item"],
                "order"       => TRUE,
                "minSize"     => 1,
                "parent"      => [
                    "name"   => "type",
                    "values" => ["blockListItems"]
                ]
            ]
        ],
        "actions"        => [
            "edit", "order", "insert", "delete"
        ]
    ];
