Commit 96dc1923 authored by alexpott's avatar alexpott
Browse files

Issue #2650994 by drunken monkey: Javascript states not working for boolean fields

parent e86e7348
......@@ -83,6 +83,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
}
}
$field_name = $this->fieldDefinition->getName();
$form['format'] = [
'#type' => 'select',
'#title' => $this->t('Output format'),
......@@ -95,7 +96,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
'#default_value' => $this->getSetting('format_custom_true'),
'#states' => [
'visible' => [
'select[name="fields[field_boolean][settings_edit_form][settings][format]"]' => ['value' => 'custom'],
'select[name="fields[' . $field_name . '][settings_edit_form][settings][format]"]' => ['value' => 'custom'],
],
],
];
......@@ -105,7 +106,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
'#default_value' => $this->getSetting('format_custom_false'),
'#states' => [
'visible' => [
'select[name="fields[field_boolean][settings_edit_form][settings][format]"]' => ['value' => 'custom'],
'select[name="fields[' . $field_name . '][settings_edit_form][settings][format]"]' => ['value' => 'custom'],
],
],
];
......
......@@ -131,7 +131,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) {
);
$elements['custom_date_format']['#states']['visible'][] = array(
':input[name="options[settings][date_format]"]' => array('value' => 'custom'),
':input[name="name="fields[' . $this->fieldDefinition->getName() . '][settings_edit_form][settings][date_format]"]' => array('value' => 'custom'),
);
$elements['timezone'] = array(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment