Skip to content
Snippets Groups Projects
Commit 96dc1923 authored by Alex Pott's avatar Alex Pott
Browse files

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

parent e86e7348
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment