Problem/Motivation
Hello, I can't implement states in a inline entity form complex widget form.
Steps to reproduce
Create a parent and a child entity.
In the child entity, create a text field A and B, and a checkbox C.
In the parent entity create a field D, that allows to refer the child entity with inline_entity_form_complexe widget.
Create a #state in the child entity with the hook hook_form_FORM_ID_alter() that allow to hide/show A or B a field when the checkbox C is checked/unchecked.
My case
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 with 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 ? Is it a issue ? The states work in normal field, but in the widget it do not works. Please look the Gif #1 (working) and the Gif #2 (not working).
This is my code :
$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],
]
];