Uploaded image for project: 'Magnolia UI'
  1. Magnolia UI
  2. MGNLUI-6860

Switchable ignores SubForm Layout Definition

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Neutral
    • None
    • None
    • None
    • None

    Description

      Steps to reproduce

      1. Define in sub-forms something like :
      switchable:
        $type: switchableField
        field:
          $type: radioButtonGroupField
          layout: horizontal
          defaultValue: option1
          datasource:
            $type: optionListDatasource
            options:
              - name: option1
                value: option1
                label: option1
              - name: option2
                value: option2
                label: option2
        itemProvider:
          $type: currentItemProvider
        forms:
          - name: option1
            layout:
              $type: horizontal
            properties:
              option1field1:
                $type: textField
                label: option1field1
              option1field2:
                $type: textField
                label: option1field2
          - name: option2
            layout:
              $type: tabbedLayout
              tabs:
                tab1:
                  fields:
                    - name: option2field1
                tab2:
                  fields:
                    - name: option2field2
            properties:
              option2field1:
                $type: textField
                label: option2field1
              option2field2:
                $type: textField
                label: option2field2
      1. Open Dialog
      2. Forms are always Vertical

      Expected results

      I would expect the form definition to be used as described in your own documentation.
      Because you refer in the switchable documentation directly to the form definition →
      https://docs.magnolia-cms.com/product-docs/6.2/Templating/Dialog-definition/Field-definition/List-of-fields/Switchable-field.html 
      https://docs.magnolia-cms.com/product-docs/6.2/Templating/Dialog-definition/Form-definition.html#_layout_types 

      Actual results

      It is always a vertical layout, no matter what I define in the YAML.

      Workaround

      As a Workaround to add more flexibility to the forms, we add a custom SwitchableFieldDefinition and a Clone of the SwitchableFormView.
      There we use the sub-form defined layout if it's not the default SingleTabLayoutProducer

      Development notes

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              Unassigned Unassigned
              ahems Alexander Hems
              Nucleus
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Checklists

                  Bug DoR
                  Task DoD