I am trying to work a conditional field based on the value input in a link field. For example, based on an external or internal link. I couldn't find a proper example, but the ones I found, I have tried this, no luck. Any idea how this can work -
$form['field_test_1']['#states'] = [
'visible' => [
':input[name="field_test_2[widget][0][uri][#default_value]"]' => 'https://www.google.com',
],
];
ok so I have worked it out, it should be like this -
$form['field_test_1']['#states'] = [
'visible' => [
':input[name="field_test_2[0][uri]"]' => [ 'value' => 'https://www.google.com' ],
],
];