I need to disable field A if field B is disabled too. Actually, my current field A has the following #states (altered using hook_alter_form) to disable it if field B or field C are empty:
/**
* Implements hook_form_alter().
*/
function my_module_form_alter(&$form, $form_state, $form_id) {
$form['field_a']['#states'] = [
'disabled' => [
[':input[name="field_b[0][value][date]"]' => ['empty' => TRUE]],
'or',
[':input[name="field_c[0][value][date]"]' => ['empty' => TRUE]],
],
];
}
And it works perfectly, but I need to add the condition mentioned before. I found this in the official documentation: https://www.drupal.org/docs/drupal-apis/form-api/conditional-form-fields and I tried to use some of them like 'readonly' or 'readwrite' but this didn't work. Can I evaluate properties like '#disabled' from here? something similar to this:
function my_module_form_alter(&$form, $form_state, $form_id) {
$form['field_a']['#states'] = [
'disabled' => [
[':input[name="field_b[0][value][date]"]' => ['empty' => TRUE]],
'or',
[':input[name="field_c[0][value][date]"]' => ['empty' => TRUE]],
'or',
[':input[name="field_b"]' => ['#disabled' => TRUE]],
],
];
}