Fixed a logic issue in Settings form

This commit is contained in:
Kyle Huynh 2023-02-07 11:13:01 -05:00
parent b1b0065c2a
commit ea2f01bce3

View file

@ -149,11 +149,6 @@ class SettingsForm extends ConfigFormBase {
->t('Enable Extended DisMax Query.'),
'#description' => $this->t('If enabled, this applies to all fields searching in the Advanced Search Block.'),
'#default_value' => self::getConfig(self::EDISMAX_SEARCH_FLAG, 1),
'#ajax' => [
'callback' => '::LuceneSearchEnableDisableCallback',
'wrapper' => 'edismax-container',
'effect' => 'fade',
],
];
$form['edismax']['textfields_container'] = [
@ -161,8 +156,6 @@ class SettingsForm extends ConfigFormBase {
'#attributes' => ['id' => 'edismax-container'],
];
if (self::getConfig(self::EDISMAX_SEARCH_FLAG, "All") === 1
|| $form_state->getValue(self::EDISMAX_SEARCH_FLAG) === 1) {
$form['edismax']['textfields_container'][self::SEARCH_ALL_FIELDS_FLAG] = [
'#type' => 'checkbox',
'#title' => $this
@ -176,7 +169,6 @@ class SettingsForm extends ConfigFormBase {
'#description' => $this->t('This will apply for the additional option above in Advanced Search block.'),
'#default_value' => self::getConfig(self::EDISMAX_SEARCH_LABEL, "All"),
];
}
return parent::buildForm($form, $form_state);
}
@ -202,13 +194,4 @@ class SettingsForm extends ConfigFormBase {
parent::submitForm($form, $form_state);
}
/**
* Callback for ajax_example_autotextfields.
*
* Selects the piece of the form we want to use as replacement markup and
* returns it as a form (renderable array).
*/
public function LuceneSearchEnableDisableCallback($form, FormStateInterface $form_state) {
return $form['edismax']['textfields_container'];
}
}