Stacks API change order of top level controls and extending existing controls

Hi,

I’m trying to extend the starter stack with some new groups and reordering them. I tried adding the key group to a group-sub-module as explained in the Element API References (https://theme.co/docs/element-api-reference#individual-controls) to change the order of the groups, but this doesn’t work.

// Top Level control group
[
'key'       => 'headings',
'type'      => 'group-sub-module',
'group'     => 'x:layout-and-design',
'label'     => __( 'Headings', '100leiden' ),
'controls'  => [ ... ]

I also tried the using the attributes data-tco-sub-module value: x-theme-options:layout-and-design. But that doesn’t seem to work either. So I have two questions:

  1. What is the right way to change the order of the top level groups?
  2. Is it possible to add controls to an existing top level group-sub-module of the starter stack when extending it with a new stack?

Thanks in advance!

1 Like

Hi,

I’m wondering if anyone has had a chance to look at this yet.

1 Like

You know I don’t think I have a feature for that in the Stack API. It is simply appending controls as you have experienced. I can see us doing this a couple of ways.

A filter, quick and simple. Could also be useful if you wanted to rearrange the starter stack itself. Something like cs_stack_controls and cs_stack_controls_starter which you could filter each stack controls when they are being built. I can get this finished a little quicker.

A new stack property. arrange => [ 'x:layout-and-design'] Where top level sub groups would be arranged by the group key.

Let me know if this sounds good with you. Thanks!

Hi @charlie,

Thanks for your reply.

The second option with a new stack property sounds great. That way you’ll have full control.

Sounds good, I will add that as a configuration option as 6.3 matures. I will also add some docs on the names of each section. Have a great day!

1 Like

Thanks, keep up the good work!

1 Like