name: zab/articles
title: "Articles"
description: "Block selected articles"
group: Content Elements
priority: -1
prefixFields: true
prefixType: full
fields:
  - identifier: Zab/GeneralRow
    type: Basic

  # Tab Header
  - identifier: tab_header
    type: Tab
    label: "Header"
  - identifier: pretitle
    type: TextInput
    label: "Pretitle"
  - identifier: title
    type: TextInput
    label: "Title"
  - identifier: info
    type: Textarea
    label: "Info"

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

  - identifier: record_articles
    type: Relation
    label: "Select Article"
    # description: '(max: 6)'
    # maxitems: 6
    allowed: "tx_zab_articles"
    displayCond: "FIELD:zab_articles_opt_type:=:get"

  - identifier: articles_create
    type: Collection
    label: " "
    minitems: 0
    appearance:
      levelLinksPosition: bottom
    displayCond: "FIELD:zab_articles_opt_type:=:create"
    fields:
      #- identifier: article_title
      #  type: TextInput
      #  label: 'Article Name'
      - identifier: article_featured_image
        type: File
        label: "Featured Image"
        maxitems: 1
        extendedPalette: false
        allowed: "jpg,jpeg,png,webp,avif"
      - identifier: opt_behavior
        type: Radio
        label: "Click Behavior"
        default: "none"
        items:
          - label: "None - image is not clickable"
            value: "none"
          - label: "Enlarge - opens full-size in lightbox"
            value: "lightbox"
          - label: "Link - opens custom URL"
            value: "link"
        onChange: reload
      - identifier: img_link
        type: Link
        label: "Link"
        displayCond: "FIELD:opt_behavior:=:link"
      - identifier: article_description
        type: Textarea
        label: "Description"
        enableRichtext: true
