fields:
  -
    handle: link_type
    field:
      options:
        -
          key: url
          value: URL
        -
          key: collection
          value: Page/Story
        -
          key: download
          value: Download
      placeholder: 'Please select'
      type: select
      display: 'Link type'
      localizable: false
      validate:
        - required
        - sometimes
      listable: false
      sortable: false
      if:
        set_type: 'not empty'
      width: 50
  -
    handle: target
    field:
      options:
        -
          key: _self
          value: 'Current tab / window'
        -
          key: _blank
          value: 'New tab / window'
      searchable: false
      default: _self
      type: select
      display: 'Link target'
      localizable: false
      validate:
        - required
      width: 50
  -
    handle: link
    field:
      type: text
      display: Link
      localizable: false
      validate:
        - sometimes
        - required
      listable: false
      sortable: false
      if:
        link_type: 'equals url'
  -
    handle: download
    field:
      max_files: 1
      container: assets
      type: assets
      display: Download
      localizable: false
      validate:
        - sometimes
        - required
      listable: false
      sortable: false
      if:
        link_type: 'equals download'
  -
    handle: page_story
    field:
      max_items: 1
      type: entries
      display: Page/Story
      localizable: false
      validate:
        - sometimes
        - required
      listable: false
      sortable: false
      collections:
        - pages
        - stories
      if:
        link_type: 'equals collection'
title: 'Optional type link'
