• 0

Nested "multi" option types in Sections


Question

Posted · Report post

In sections is it possible to have nested "multi" option types?

 

$opts = array(
    array(
        'key'           => 'key1',
        'type'          => 'multi',
        'title'           => 'Nested Mulit Opts',
        'label'         => 'Example of nested options',
        'help'          => __('Unselected values default to 0 or none.', 'pagelines'),
        'ref'            => __( 'If you are having issues or need more help please contact me <a href="http://twitter.com/MarioGiancini" target="_blank">@MarioGiancini</a>.', 'pagelines' ),
        'opts'          =>  array(
            'key'           => 'key1_1',
            'type'          => 'multi',
            'title'           => 'First Nested',
            'label'         => 'First Nested Label',
            'opts'          =>  array(
                array(
                    'key'           => 'key1_1_1',
                    'type'          => 'select',
                    'title'           => 'Key 1.1.1',
                    'label'         => 'Set the Key Value',
                    'opts'          => array(
                                        'top'           => array( 'name' => 'Text on top of button' ),
                                        'inline'        => array( 'name' => 'Text/Button Inline' )
                                    )
                ),
                array(
                    'key'           => 'key1_1_2',
                    'type'          => 'select',
                    'title'           => 'BKey 1.1.2',
                    'label'         => 'Set the Key Value',
                    'opts'          => array(
                                        'top'           => array( 'name' => 'Text on top of button' ),
                                        'inline'        => array( 'name' => 'Text/Button Inline' )
                                    )
                )
            ),
            array(
                'key'           => 'key1_2',
                'type'          => 'text',
                'title'           => 'Second in Multi',
                'label'         => 'Type Away!'
            )
        )
    )
):

 

Share this post


Link to post
Share on other sites

4 answers to this question

  • 0

Posted · Report post

I'm sorry, but your question is rather vague.  Nested drop down lists where? For what purpose?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Rob,

I'm trying my hand at custom sections in a child theme.

There's a part in the docs that describes the different options you can include, like text, color, image, and multi. Multi lets you nest more than one option within an option box. So in one box you can have several text fields, a color picker, etc,, instead a separate box for each option setting. I wondering if its possible to have more than one level of "multi" options.

Example:

Box 1(multi opt)
-text field 1
-Opt section (multi level 2)
-image field
-color field
-text field 2
-Opt section (multi level 2)
-image field
-color field

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Apologies for any vagueness.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hi,

 

To be honest, PHP is currently not my forte, so I am guessing here and I think that its not possible, but I could be wrong. I will see speak to one of our devs and find out for sure if its possible or not.

 

In the meantime, I think the best thing for you would be to just try it and see what happens.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now