I have entity "parking_lot" with several "pricings", in the "parking_lot" entity form, there is a field "pricings" using the widget inline_entity_form_complex. In the parking_lot form I set conditional fields with the #states API (to display fields only sometimes swith a boolean field). The #states works but only in the original form of a "pricing" entity, but when I edit a pricing from the parking_lot entity, the #states doesn't works. How to set #states in a inline_entity_form_complex field widget ? The states work in normal field, but in the widget it do not works. This is my code. Please look the Gif #1 (working) and the Gif #2 (not working).
A created a hook_form_FORM_ID_alter() :
$form['field_level_time_unit']['#states'] = [
'invisible' => [
'input[name="field_level_pricing_mode"]' => ['value' => 0],
]
];
$form['field_level_price']['#states'] = [
'invisible' => [
'input[name="field_level_pricing_mode"]' => ['value' => 0],
]
];
$form['field_level_of_reference']['#states'] = [
'visible' => [
'input[name="field_level_pricing_mode"]' => ['value' => 0],
]
];
The #states is not working with the widget inline_entity_form_complex :