name: zab/faqs
title: "FAQs"
description: "Block FAQs"
group: Content Elements
priority: -6
prefixFields: true
prefixType: full
fields:
  - identifier: Zab/GeneralRow
    type: Basic

  - identifier: tab_content
    type: Tab
    label: "Content"
  - identifier: row_2
    type: Palette
    fields:
      - identifier: title
        type: TextInput
        label: "Title"
      - identifier: opt_sticky
        type: Checkbox
        label: "Sticky Headline"
        renderType: checkboxToggle
  - identifier: info
    type: Textarea
    label: "Info"

  - identifier: tab_faqs
    type: Tab
    label: "FAQs"
  - identifier: opt_type
    type: Select
    label: "Select Type of Faqs"
    renderType: selectSingle
    default: "get"
    items:
      - label: "Get From Records"
        value: get
      - label: "Create Faqs"
        value: create
    onChange: reload

  #- identifier: faqs_records
  #  type: Select
  #  label: ' '
  #  renderType: selectMultipleSideBySide
  #  foreign_table: tx_zab_faqs
  #  displayCond: 'FIELD:zab_faqs_opt_type:=:get'

  - identifier: palette_0
    type: Palette
    label: "Faqs"
    fields:
      - identifier: faqs_category
        type: Select
        label: "Filter by Category"
        renderType: selectSingle
        foreign_table: tx_zab_faqs_category
        foreign_table_where: "AND tx_zab_faqs_category.sys_language_uid = ###REC_FIELD_sys_language_uid### ORDER BY tx_zab_faqs_category.sorting"
        onChange: reload
        items:
          - label: "[ All ]"
            value: 0
        displayCond: "FIELD:zab_faqs_opt_type:=:get"
      - type: Linebreak
      - identifier: faqs_records
        type: Select
        label: " "
        renderType: selectMultipleSideBySide
        foreign_table: tx_zab_faqs
        itemsProcFunc: 'Zab\ZabSite\Utility\ContentOptions->getFaqsByCategory'
        displayCond: "FIELD:zab_faqs_opt_type:=:get"

  - identifier: faqs_create
    type: Collection
    label: " "
    minitems: 0
    appearance:
      levelLinksPosition: bottom
    displayCond: "FIELD:zab_faqs_opt_type:=:create"
    fields:
      - identifier: label
        type: TextInput
        label: "Question"
      - identifier: text
        type: Textarea
        label: "Answer"
        enableRichtext: true

      - identifier: tab_downloads
        type: Tab
        label: "Downloads"
      - identifier: downloads_category
        type: Select
        label: "Filter by Category"
        renderType: selectSingle
        foreign_table: tx_zab_downloads_category
        foreign_table_where: "ORDER BY tx_zab_downloads_category.sorting"
        onChange: reload
        items:
          - label: "[ All ]"
            value: 0
      - identifier: downloads_records
        type: Select
        label: " "
        renderType: selectMultipleSideBySide
        foreign_table: tx_zab_downloads
        itemsProcFunc: 'Zab\ZabSite\Utility\ContentOptions->getDownloadsByCategory'

  - identifier: tab_bar
    type: Tab
    label: "Banner"
  - identifier: opt_color
    label: "Banner Color"
    type: Select
    renderType: selectSingle
    itemsProcFunc: 'Zab\ZabSite\Utility\ContentOptions->getColorSimple'
    items:
      - label: "Green dark"
        value: accent
  - identifier: label
    type: TextInput
    label: "Title"
  - identifier: row_1
    type: Palette
    fields:
      - identifier: link1
        type: Link
        label: "Link 1"
        allowedTypes:
          - page
          - url
          - file
      - identifier: link2
        type: Link
        label: "Link 2"
        allowedTypes:
          - page
          - url
          - file
