How to use required argument in Redux Framework based on checkbox sortable?

Good evening,

I have the following option in Redux Framework (version 3.1.9):

Read More
array(
        'id'        => 'social-networks',
        'type'      => 'sortable',
        'mode'      => 'checkbox',
        'title'     => __('Order Social Icons', 'options'),
        'subtitle'  => __('Order and activate/deactivate social icons', 'options'),
        'options'   => array(
            'fb' => 'Facebook',
            'tw' => 'Twitter',
            'lin' => 'LinkedIn',
        )
    ),

And the output (if all three options are checked) is:

[fb] => 1
[tw] => 1
[lin] => 1

After this option I want to display a text field for every checked social network in this list and I have the example text input:

array(
  'id' => 'facebook-url',
  'type' => 'text',
  'required' => array('social-networks["fb"]','equals','1'),
  'title' => __('Facebook URL', 'options'),
  'subtitle' => __('Enter your Facebook URL.', 'options'),
),

Of course the “required” argument doesn’t work.

Is there a way to use this argument by using an option from a field and not only the ID.

Thanks

Related posts

Leave a Reply

1 comment

  1. According to http://docs.reduxframework.com/redux-framework/arguments/required/, your conditional option should look like this:

    array(
      'id' => 'facebook-url',
      'type' => 'text',
      'required' => array('social-networks','equals','fb'),
      'title' => __('Facebook URL', 'options'),
      'subtitle' => __('Enter your Facebook URL.', 'options'),
    ),
    

    Next option:

    array(
      'id' => 'twitter-url',
      'type' => 'text',
      'required' => array('social-networks','equals','tw'),
      'title' => __('Twitter URL', 'options'),
      'subtitle' => __('Enter your twitter URL.', 'options'),
    ),
    

    and so on.