# Schema for configuration files of the Entity browser module.

entity_browser.browser.*:
  type: config_entity
  label: 'Entity browser'
  mapping:
    name:
      type: string
      label: 'Machine name'
    label:
      type: label
      label: 'Label'
    display:
      type: string
      label: 'Display plugin ID'
    display_configuration:
      type: entity_browser.browser.display.[%parent.display]
    selection_display:
      type: string
      label: 'Selection display plugin ID'
    selection_display_configuration:
      type: entity_browser.browser.selection_display.[%parent.selection_display]
    widget_selector:
      type: string
      label: 'Widget selector plugin ID'
    widget_selector_configuration:
      type: entity_browser.browser.widget_selector.[%parent.widget_selector]
    widgets:
      type: sequence
      label: 'Widgets'
      sequence:
        type: mapping
        mapping:
          id:
            type: string
          uuid:
            type: string
          label:
            type: label
          weight:
            type: integer
          settings:
            type: entity_browser.browser.widget.[%parent.id]

entity_browser.browser.display.standalone:
  type: mapping
  label: 'Standalone display configuration'
  mapping:
    path:
      type: string
      label: 'Page path'

entity_browser.browser.display.iframe:
  type: mapping
  label: 'iFrame display configuration'
  mapping:
    width:
      type: string
      label: 'iFrame width'
    height:
      type: string
      label: 'iFrame height'
    link_text:
      type: string
      label: 'Link text'
    auto_open:
      type: boolean
      label: 'Auto open'

entity_browser.browser.display.modal:
  type: mapping
  label: 'Modal display configuration'
  mapping:
    width:
      type: string
      label: 'Modal width'
    height:
      type: string
      label: 'Modal height'
    link_text:
      type: string
      label: 'Link text'
    auto_open:
      type: boolean
      label: 'Auto open'

entity_browser.browser.widget.upload:
  type: mapping
  label: 'Upload widget configuration'
  mapping:
    submit_text:
      type: string
      label: 'Submit button text'
    upload_location:
      type: string
      label: 'Upload location'
    multiple:
      type: boolean
      label: 'Allow multiple uploads'
    extensions:
      type: string
      label: 'Allowed file extensions'

entity_browser.browser.widget.view:
  type: mapping
  label: 'View widget configuration'
  mapping:
    submit_text:
      type: string
      label: 'Submit button text'
    auto_select:
      type: boolean
      label: 'Automatically submit selection'
    view:
      type: string
      label: 'View ID'
    view_display:
      type: string
      label: 'View display ID'
    arguments:
      type: sequence
      sequence:
        type: integer
        label: 'View display arguments'

entity_browser.browser.selection_display.multi_step_display:
  type: mapping
  label: 'Multistep display configuration'
  mapping:
    entity_type:
      type: string
      label: 'Entity type'
    display:
      type: string
      label: 'Display'
    display_settings:
      type: entity_browser.field_widget_display.[%parent.display]
    select_text:
      type: string
      label: 'Select text'
    selection_hidden:
      type: boolean
      label: 'Selection hidden by default'

entity_browser.browser.selection_display.view:
  type: mapping
  label: 'View display configuration'
  mapping:
    view:
      type: string
      label: 'View ID'
    view_display:
      type: string
      label: 'View display ID'

field.widget.settings.entity_browser_entity_reference:
  type: mapping
  label: 'Entity browser entity reference widget'
  mapping:
    entity_browser:
      type: string
      label: 'Entity Browser'
    field_widget_display:
      type: string
      label: 'Field widget display'
    field_widget_edit:
      type: boolean
      label: 'Field widget edit'
    field_widget_remove:
      type: boolean
      label: 'Field widget remove'
    field_widget_replace:
      type: boolean
      label: 'Field widget replace'
    open:
      type: boolean
      label: 'Open'
    field_widget_display_settings:
      type: entity_browser.field_widget_display.[%parent.field_widget_display]
    selection_mode:
      type: string
      label: 'Selection mode'

entity_browser.field_widget_display.label:
  type: mapping
  label: 'Entity label display config'

entity_browser.field_widget_display.thumbnail:
  type: mapping
  label: 'Image thumbnail display config'
  mapping:
    image_style:
      type: string
      label: 'Image style'

entity_browser.field_widget_display.rendered_entity:
  type: mapping
  label: 'Rendered entity display config'
  mapping:
    view_mode:
      type: string
      label: 'View mode'

field.widget.settings.entity_browser_file:
  type: mapping
  label: 'Entity browser file widget'
  mapping:
    entity_browser:
      type: string
      label: 'Entity Browser'
    field_widget_edit:
      type: boolean
      label: 'Field widget edit'
    field_widget_remove:
      type: boolean
      label: 'Field widget remove'
    field_widget_replace:
      type: boolean
      label: 'Field widget replace'
    open:
      type: boolean
      label: 'Open'
    selection_mode:
      type: string
      label: 'Selection mode'
    view_mode:
      type: string
      label: 'View mode'
    preview_image_style:
      type: string
      label: 'Preview image style'

views.display.entity_browser:
  type: views_display
  label: 'Entity browser display options'
