Fields may be linked/required/folded according to a/multiple parent value(s). This is accomplished by appending a
required argument, similar to the following, on ant given field:
'required' => array('layout','equals','1')
- The first value of the array is the field ID in which to link the field to.
- The second value is the operation to perform.
- The third value is the value to compare against.
It can also be used with multiple “parent” required values. If all of these conditions are not met, this field will not be visible and the output CSS will not be used. An example is as
'required' => array( array('layout','equals','1'), array('parent','!=','Testing') )
|=||$a = $b|
|equals||$a = $b|
|!=||$a != $b|
|not||$a != $b|
|>||$a > $b|
|greater||$a > $b|
|is_larger||$a > $b|
|>=||$a >= $b|
|greater_equal||$a >= $b|
|is_larger_equal||$a >= $b|
|<||$a < $b|
|less||$a < $b|
|is_smaller||$a < $b|
|<=||$a <= $b|
|less_equal||$a <= $b|
|is_smaller_equal||$a <= $b|
|contains||(strpos($a, $b) !== false)|
|doesnt_contain||(strpos($a, $b) === false)|
|not_contain||(strpos($a, $b) === false)|
|not_empty_and||if (!empty($value1) && $value1 != $value2)|
As of Redux 3.2.0 nested fully works! You can nest these requirements as much as you want. If any parent is hidden or doesn’t match the value, all children are hidden and all CSS output from those children is hidden as well.
CSS output to both the head and compiler is removed from each field if the required value(s) is/are not met. You can, however, override this on a per field basis by setting
'force_output' => true for each field you want CSS to still be output with. This way you can nest a field under another, and still have it output to the dynamic CSS.
The CSS output will always be visible if items are within a
section field unless that specific field has the required value set to the required parent as well.