Code Monkey home page Code Monkey logo

Comments (5)

 avatar commented on May 29, 2024

Maybe you can use only 2 options if 9 of 10 are the same?

Can you provide the option-type array so we can understand better why you need such functionality?

from unyson.

themesmeta avatar themesmeta commented on May 29, 2024

Sure, here we go:

    'box_type_select' => array(
        'type'  => 'multi-picker',
        'label' => false,
        'desc'  => false,
        'picker' => array(
            'box_type' => array(
                'label'   => __('Select type', 'fw'),
                'type'    => 'select',
                'choices' => array(
                    '' => __( 'Default (no icon)', 'fw' ),
                    'box-1' => __( 'Box-1 title', 'fw' ),
                    'box-2' => __( 'Box-2 title', 'fw' ),
                    'box-3' => __( 'Box-3 title', 'fw' ),
                    'box-4' => __( 'Box-4 title', 'fw' ),
                    'box-5' => __( 'Box-5 title', 'fw' ),
                                        'box-6' => __( 'Box-6 title', 'fw' ),
                                        'box-7' => __( 'Box-7 title', 'fw' ),
                                        'box-8' => __( 'Box-8 title', 'fw' ),
                                        'box-9' => __( 'Box-9 title', 'fw' ),
                )
            )
        ),
        'choices' => array(
            'box-1' => array(
                'box_icon_anim' => array(
                    'type'  => 'select',
                    'label' => __('Choose an animation icon', 'fw'),
                    'choices' => array(
                        'fw-icon-macbook' => __('Animation icon Macbook', 'fw'),
                        'fw-icon-browser' => __('Animation icon Browser', 'fw'),
                        'fw-icon-clock' => __('Animation icon Clock', 'fw'),
                                                .....
                    )
                )
            ),
            'box-2' => array(
                'box_icon' => array(
                    'type'  => 'icon',
                    'label' => __('Choose an icon', 'fw'),
                )
            ),
            box-3' => array(
                'box_icon' => array(
                    'type'  => 'icon',
                    'label' => __('Choose an icon', 'fw'),
                )
            ),
            box-4' => array(
                'box_icon' => array(
                    'type'  => 'icon',
                    'label' => __('Choose an icon', 'fw'),
                )
            ),
            box-5' => array(
                'box_icon' => array(
                    'type'  => 'icon',
                    'label' => __('Choose an icon', 'fw'),
                )
            ),
            box-6' => array(
                'box_icon' => array(
                    'type'  => 'icon',
                    'label' => __('Choose an icon', 'fw'),
                )
            ),
            box-7' => array(
                'box_icon' => array(
                    'type'  => 'icon',
                    'label' => __('Choose an icon', 'fw'),
                )
            ),
            box-8' => array(
                'box_icon' => array(
                    'type'  => 'icon',
                    'label' => __('Choose an icon', 'fw'),
                )
            ),
            box-9' => array(
                'box_icon' => array(
                    'type'  => 'icon',
                    'label' => __('Choose an icon', 'fw'),
                )
            ),
        ),
        'show_borders' => false,
    ),

from unyson.

 avatar commented on May 29, 2024

I don't know how to solve this.

Maybe you have an idea how this can be done?

from unyson.

themesmeta avatar themesmeta commented on May 29, 2024

Hey @moldcraft ,
I wish I can do something like this:

'box_icon' => array(
    'type'  => 'icon',
    'label' => __('Choose an icon', 'fw'),
    'dependencies' => array(
        'element' => 'box_type',
        'value' => array('box-2', 'box-3', 'box-4', 'box-5', 'box-6', 'box-7', 'box-8', 'box-9')
    )
)

Hope this makes sense.
Anyway, you guys did a great work with this framework. Thanks so much !

from unyson.

rockalife avatar rockalife commented on May 29, 2024

Hello @raynguyen,

This is an interesting idea, for now you could store the repeating options into a variable and merge the multi-picker choices with it when you need to include them.

$price_option = array(
    'price' => array(
        'type'  => 'text',
        'label' => __('Price', 'fw'),
    )
);

$options = array(
    'demo' => array(
        'type'  => 'multi-picker',
        'label' => false,
        'desc'  => false,
        'picker' => array(
            'gadget' => array(
                'label'   => __('Test', 'fw'),
                'desc'    => __('Test', 'fw'),
                'type'    => 'select',
                'choices' => array(
                    'phone'  => __('Phone', 'fw'),
                    'laptop' => __('Laptop', 'fw')
                ),

            )
        ),
        'choices' => array(
            'phone' => array_merge(
                $price_option,
                array(
                    'memory' => array(
                        'type'  => 'select',
                        'label' => __('Memory', 'fw'),
                        'choices' => array(
                            '16' => __('16Gb', 'fw'),
                            '32' => __('32Gb', 'fw'),
                            '64' => __('64Gb', 'fw'),
                        )
                    )
                )
            ),
            'laptop' => array_merge(
                $price_option,
                array(
                    'webcam' => array(
                        'type'  => 'switch',
                        'label' => __('Webcam', 'fw'),
                    )
                )
            ),
        ),
        'show_borders' => false,
    ),
);

You will have to chose from generating the choices via code (like in the example above or some tricky foreach loop) or just stick with copy pasting the options for now.

Hope this helps and thank you for your contribution.

from unyson.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.