Skip to content

Issue: #3468272 - Move to multi-cardinality flat tree

Closes #3468272

Before - one field item (single value cardinality) with tree and inputs props After - mutli-cardinality with component_id, parent_uuid, uuid, slot and inputs props

How does this change the values set for a component tree?

See the 👈️ comments below

Before

     'component_tree' => [ // 👈️ Single item/value with tree and inputs keys
        'tree' => [ // 👈️ Separate tree key
          ComponentTreeStructure::ROOT_UUID => [ // 👈️ Root identifier
            ['uuid' => 'uuid-in-root', 'component' => 'sdc.xb_test_sdc.props-slots'], // 👈️ uuid and component ID
            ['uuid' => 'uuid-in-root-another', 'component' => 'sdc.xb_test_sdc.props-no-slots'], // 👈️ Note fake UUID
            ['uuid' => 'uuid-in-root-another-again', 'component' => 'sdc.experience_builder.heading'],
          ],
          'uuid-in-root' => [
            'the_body' => [
               ['uuid' => 'local_tasks', 'component' => 'block.local_tasks_block'], // 👈️ Nested item
            ],
          ],
        ],
        'inputs' => [ // 👈️ Single separate inputs key
          'local_tasks' => [ // 👈️ Keyed by component instance UUID
            'label_display' => FALSE,
            'primary' => TRUE,
            'secondary' => TRUE,
            'label' => '',
          ],
          'uuid-in-root' => [
            'heading' => $generate_static_prop_source('world'),
          ],
          'uuid-in-root-another' => [
            'heading' => $generate_static_prop_source('another world'),
          ],
          'uuid-in-root-another-again' => [
            'text' => $generate_static_prop_source('heading level three'),
            'element' => [
              'sourceType' => 'static:field_item:list_string',
              'value' => 'h3',
              'expression' => 'ℹ︎list_string␟value',
            ],
          ],
        ],
      ],

After

[ // 👈️ Multiple items, one per instance
        [
          'uuid' => '8c59b08a-59f7-4c33-b1b6-06af8f153e73', // 👈️ Real UUIDs
          'component_id' => 'sdc.xb_test_sdc.props-slots', // 👈️ Changed to 'component_id'
          'inputs' => [ // 👈️ Inputs stored in the same item instead of in bulk
            'heading' => $generate_static_prop_source('world'),
          ],
        ],
        [
          'uuid' => 'cdaf905d-4b07-4f3c-a691-4b9d07891124',
          'component_id' => 'sdc.xb_test_sdc.props-no-slots',
          'inputs' => [
            'heading' => $generate_static_prop_source('another world'),
          ],
        ],
        [
          'uuid' => '02f06f2a-c3af-4f71-8920-5f74169a88a5',
          'component_id' => 'sdc.experience_builder.heading',
          'inputs' => [
            'text' => $generate_static_prop_source('heading level three'),
            'element' => [
              'sourceType' => 'static:field_item:list_string',
              'value' => 'h3',
              'expression' => 'ℹ︎list_string␟value',
            ],
          ],
        ],
        [
          'uuid' => '56031f0f-a073-471d-8298-4ecf757ff0e7',
          'component_id' => 'block.local_tasks_block',
          'parent_uuid' => '8c59b08a-59f7-4c33-b1b6-06af8f153e73', // 👈️ Nested component refers to it's parent instance by UUID
          'slot' => 'the_body', // 👈️ Slot in which this sits
          'inputs' => [
            'label_display' => FALSE,
            'primary' => TRUE,
            'secondary' => TRUE,
            'label' => '',
          ],
        ],
      ],
Edited by Lee Rowlands

Merge request reports

Loading