WIP: Map_fields => true within a repeater item not working

I’m using the filter bricks/elements/form/controls for a custom form action settings panel which includes a repeater control. I’d like one of the fields in the repeater to be a select for a form field, however the auto-population of options does not appear to work:

$controls['customFieldsRepeater'] = [
  'group' => 'my-custom-action',
  'label' => esc_html__( 'Custom Fields', 'bricks' ),
  'type' => 'repeater',
  'default' => [
    [
      'title' => 'Custom Field',
    ],
  ],
  'fields' => [
    'field' => [
      'label' => esc_html__( 'Field', 'bricks' ),
      'type' => 'text',
    ],
    'value' => [
      'label' => esc_html__( 'Value', 'bricks' ),
      'type' => 'select',
      'multiple' => false,
      'options' => [],
      'map_fields' => true, // does not work
    ],
  ],
];

It works when not using a repeater. Is this intended behaviour?

@timmse I’m not sure if I should raise this as a bug? This part of the codebase has a comment saying the option is undocumented (but it’s used in examples on Bricks Academy) so I’m not sure if this is by design.

Hi @jamie,

The academy example and all instances of map_fields are not within a repeater control, so this would not be a bug; it is more of an improvement request.

We have added this to our to-do list :slight_smile:

1 Like

Thanks @charaf

I think it would be useful to implement. My use-case is to allow any number of custom fields to be sent to Campaign Monitor. Being able to do this in a repeater means I can enter the custom field key/name and choose the respective form field easily.

1 Like