Fixed a logic issue in Settings form
This commit is contained in:
parent
b1b0065c2a
commit
ea2f01bce3
1 changed files with 13 additions and 30 deletions
|
|
@ -149,11 +149,6 @@ class SettingsForm extends ConfigFormBase {
|
||||||
->t('Enable Extended DisMax Query.'),
|
->t('Enable Extended DisMax Query.'),
|
||||||
'#description' => $this->t('If enabled, this applies to all fields searching in the Advanced Search Block.'),
|
'#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),
|
'#default_value' => self::getConfig(self::EDISMAX_SEARCH_FLAG, 1),
|
||||||
'#ajax' => [
|
|
||||||
'callback' => '::LuceneSearchEnableDisableCallback',
|
|
||||||
'wrapper' => 'edismax-container',
|
|
||||||
'effect' => 'fade',
|
|
||||||
],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$form['edismax']['textfields_container'] = [
|
$form['edismax']['textfields_container'] = [
|
||||||
|
|
@ -161,8 +156,6 @@ class SettingsForm extends ConfigFormBase {
|
||||||
'#attributes' => ['id' => 'edismax-container'],
|
'#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] = [
|
$form['edismax']['textfields_container'][self::SEARCH_ALL_FIELDS_FLAG] = [
|
||||||
'#type' => 'checkbox',
|
'#type' => 'checkbox',
|
||||||
'#title' => $this
|
'#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.'),
|
'#description' => $this->t('This will apply for the additional option above in Advanced Search block.'),
|
||||||
'#default_value' => self::getConfig(self::EDISMAX_SEARCH_LABEL, "All"),
|
'#default_value' => self::getConfig(self::EDISMAX_SEARCH_LABEL, "All"),
|
||||||
];
|
];
|
||||||
}
|
|
||||||
|
|
||||||
return parent::buildForm($form, $form_state);
|
return parent::buildForm($form, $form_state);
|
||||||
}
|
}
|
||||||
|
|
@ -202,13 +194,4 @@ class SettingsForm extends ConfigFormBase {
|
||||||
parent::submitForm($form, $form_state);
|
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'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue