Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Request to add new option parameter in a settings field.

Open therakib7 opened this issue 9 years ago • 1 comments

Hello, Before using Unyson, I used Redux Framework for settings field. I saw in unyson to required a field that's mean show a field depending on another field need to use type multi-picker. This field is awesome but sometimes I faced some problem. Like I created a multi-picker select field and Select field has more than 20 options. From 20 options when selecting any 5 options I want to show a field. But in unyson system, I need to create same type of field again and again. like below code. see latest_post_sec_label id in the code

'template_layout_options'  => array(
    'type'         => 'multi-picker',
    'label'        => false,
    'desc'         => false,
    'picker'       => array(
        'template_layout' => array(
            'type'    => 'select',
            'label'    => esc_html__( 'Template Layout', 'text-domain' ),
            'choices' => array(
                'blog-home-one' => esc_html__( 'Blog Home One', 'text-domain' ),
                'blog-home-two' => esc_html__( 'Blog Home Two', 'text-domain' ),
                'blog-home-three' => esc_html__( 'Blog Home Three', 'text-domain' ),
                'blog-home-four' => esc_html__( 'Blog Home Four', 'text-domain' ),
                'blog-home-five' => esc_html__( 'Blog Home Five', 'text-domain' ),
                'blog-home-six' => esc_html__( 'Blog Home Six', 'text-domain' ),
                'blog-home-seven' => esc_html__( 'Blog Home Seven', 'text-domain' ),
                'blog-home-eight' => esc_html__( 'Blog Home Eight', 'text-domain' ),
            ),
            'value'    => 'blog-home-one',
        ),
    ),
    'choices'  => array(                          
        'blog-home-two' => array(
            'latest_post_sec_label' => array(
                'type' => 'text',
                'label' => esc_html__('Latest Post Section Title', 'text-domain'),
            ),
        ),
        'blog-home-three' => array(
            'latest_post_sec_label' => array(
                'type' => 'text',
                'label' => esc_html__('Latest Post Section Title', 'text-domain'),
            ),
        ),
        'blog-home-four'  => array(
            'latest_post_sec_label' => array(
                'type' => 'text',
                'label' => esc_html__('Latest Post Section Title', 'text-domain'),
            ),
        ),
        'blog-home-five' => array(            
            
        ),
    ),
),

In redux it is much easier like this

array(
    'id' => 'latest_post_sec_label',
    'type' => 'text',
    'label' => esc_html__('Latest Post Section Title', 'ramble'),
    'required'    => array(
    'template_layout', '=', array( 'blog-home-two', 'blog-home-four', 'blog-home-five' ) 
     )
),

Or

array(
    'id' => 'latest_post_sec_label',
    'type' => 'text',
    'label' => esc_html__('Latest Post Section Title', 'ramble'),
    'required' => array( 
        array('template_layout','=','blog-home-two'), 
        array('template_layout','=','blog-home-four'), 
        array('template_layout','=','blog-home-five'),  
    )
),

So I request you to add an extra parameter like redux required.

Advance Thanks

therakib7 avatar Dec 11 '16 05:12 therakib7

:+1:

albertso avatar Dec 19 '16 01:12 albertso