id: user_profile_entity_form_display
label: User profile form display configuration
migration_tags:
  - Drupal 6
  - Drupal 7
  - Configuration
source:
  plugin: profile_field
  constants:
    empty: {}
    entity_type: user
    bundle: user
    form_mode: default
process:
  entity_type: 'constants/entity_type'
  bundle: 'constants/bundle'
  field_name:
    -
      plugin: migration_lookup
      migration: user_profile_field
      source: fid
    -
      plugin: skip_on_empty
      method: row
    -
      plugin: extract
      index:
        - 1
  form_mode: 'constants/form_mode'
  type:
    plugin: static_map
    source: type
    map:
      checkbox: boolean_checkbox
      date: datetime_default
      list: text_textfield
      selection: options_select
      textfield: text_textfield
      textarea: text_textarea
      url: link_default
  options: 'constants/options'
  'options/type': '@type'
  'options/settings':
    plugin: field_instance_widget_settings
    source:
      - '@type'
      - 'constants/empty' # we don't have any settings.
  'options/settings/display_label':  # Single on/off checkboxes need to have display_label = true otherwise their label doesn't show.
    plugin: static_map
    default_value: false
    source: type
    map:
      checkbox: true
  hidden:
    plugin: static_map
    source: visibility
    default_value: false
    map:
      1: true # PROFILE_PRIVATE
      4: true # PROFILE_HIDDEN
destination:
  plugin: component_entity_form_display
migration_dependencies:
  required:
    - user_profile_field_instance
