Nuxy
  • Nuxy
  • Installation
  • Adding Page Options
  • Adding Post Options
  • Adding Taxonomy Options
  • Adding Frontend Options
  • Getting Fields
  • Adding to admin bar
  • Tabs
    • General tab parameters
    • Add submenu
  • Field parameters
  • Registering field
  • Fields dependency
  • Fields group
  • Field types
    • General field parameters
    • 1. Text
    • 2. Number
    • 3. Textarea
    • 4. Checkbox
    • 5. Select
    • 6. Radio
    • 7. Color
    • 8. Image
    • 9. Editor
    • 10. Autocomplete
    • 11. Datepicker
    • 12. Datepicker range
    • 13. Time
    • 14. Sortable
    • 15. Sortable multi input
    • 16. Gallery
    • 17. Repeater
    • 18. Range slider
    • 19. Image Select
    • 20. Button group
    • 21. Icon picker
    • 22. Ace Editor
    • 23. Spacings
    • 24. Link color
    • 25. Multi checkbox
    • 26. Color Gradient
    • 27. Textarea with hints
    • 28. Typography
    • 29. Multiselect
    • 30. Notification Message
    • 31. Button List
    • 32. Group Title with Preview && Icon
  • Download Nuxy
Powered by GitBook
On this page
  • Overview of the Fields Dependency
  • Sorted Field Dependency Mode

Fields dependency

PreviousRegistering fieldNextFields group

Last updated 5 months ago

Overview of the Fields Dependency

This option serves to define the dependency of different fields. It shows the connections of various fields and indicates the changes in the values of options.

It’s critical to understand the work of the dependencies. Let's break the process down with an example.

The fields won’t be displayed unless a particular setting is enabled or selected.

  1. For example, there is a field for skin color setup. By default, the theme color are applied and there are no additional settings. But if you select the Custom Color option, the new fields (color picker) will be displayed. These fields depend on the Custom Color option.

'dependency' => array(
    'key' => 'footer_custom_settings',
    'value' => 'not_empty'
)

The 'value' => 'not_empty' indicates that if the setting is enabled, the field will be displayed.

2. Another example of dependency usage. There are three option fields, two of them depend on the third one. When you select Hide Footer (enable the option) other two settings will be automatically disabled and hidden.

'dependency' => array(
    'key' => '‘footer_show_hide',
    'value' => 'empty'
)

The 'value' => 'empty' indicates that if the setting is disabled (or not selected) the field won’t be displayed

3. There is also another way of dependency management when some of the fields depend on two options at once.

'dependency' => array(
    array(
        'key' => 'footer_custom_settings',
        'value' => 'not_empty'
    ),
    array(
        'key' => 'footer_show_hide',
        'value' => 'empty'
    )
),
'dependencies' => '&&'

Pay attention to the “dependencies” option. It shows that a particular field depends on multiple options.

The value of '&&' means “and” here, and the option depends on fields 1 and 2.

You can also use “||” - to indicate “or” - for example, if the field depends on several options, and if only one of them is selected (enabled).

NOTE: if dependency field located in another section, you have to add section name parameter to dependency array:

'dependency' => array(
    array(
        'key' => 'footer_custom_settings',
        'value' => 'not_empty',
        'section' => 'my_section_name'
    ),
),
'dependency_mode' => 'disabled',

and setting will be disabled.

For example, we need to show, that the WooCommerce cart is disabled for Header style 6:

Sorted Field Dependency Mode

Sorted field dependency mode works with an interactive sorted two-column drag-and-drop interface.

  • Disable Layouts — fields in this block (column) will be unavailable for modification. They will be disabled which means users can not make any changes to these fields.

Here is the example code to implement the feature:

'group'      => 'started'
'dependency' => array(
    array(
        'key' => 'sorted_steps',
        'value' => 'item_gallery',
    ),
    'dependency_mode' => 'sorted',
),

This field dependency mode works with group fields only.


Sometimes you need to show that the setting is not available in certain cases, just add

Enable Layouts — fields in this block (column) will be available to modify. Users can enter texts, select options, or make any changes based on the

You can configure the key and value parameters as shown in the

🚩
🚩
🚩
field type.
overview.