I have a field as such in PHP:
return [
'text1' => [
'control' => [
'text' => [
'show_if' => [
'field' => 'text2',
'comparison' => '===',
'Show text 1'
]
]
]
],
'text2' => [
'control' => 'text'
]
];
In theory text1's control (a form) should only show if text2's value is ever Show text 1, but I'm baffled as to how I'd transfer this relationship from PHP to JS.
I can't use eval, since that's evil, but is there no way for me to practically transform the code?
In other words, I'm trying to get PHP to tell JS to do:
(if text2 !== 'Show text 1') {
//Don't show text 1
}
echo json_encode($array);???(if text2 !== 'Show text 1') { //don't show text1