Skip to content
Snippets Groups Projects

Fix DeepL free tier API not usable after unchecking DeepL pro checkbox

Merged tgoeg requested to merge issue/auto_translation-3526941:auto_translation-3526941 into 1.0.x
3 files
+ 19
5
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -289,11 +289,11 @@ class AutoTranslatorSettingsForm extends ConfigFormBase {
],
];
$form['configuration_nodes']['api_settings']['auto_translation_api_deepl_mode'] = [
$form['configuration_nodes']['api_settings']['auto_translation_api_deepl_pro_mode'] = [
'#type' => 'checkbox',
'#title' => $this->t('Use DeepL Pro API'),
'#description' => $this->t('If checked, the DeepL Pro API will be used. If unchecked, the free version of DeepL will be used.'),
'#default_value' => $config->get('auto_translation_api_deepl_mode'),
'#default_value' => (bool) $config->get('auto_translation_api_deepl_pro_mode'),
'#states' => [
'visible' => [
':input[name="auto_translation_provider"]' => ['value' => 'deepl'],
@@ -367,7 +367,7 @@ class AutoTranslatorSettingsForm extends ConfigFormBase {
->set('auto_translation_content_types', $form_state->getValue('auto_translation_content_types'))
->set('auto_translation_api_enabled', (bool) $form_state->getValue('auto_translation_api_enabled'))
->set('auto_translation_api_key', $encryptedApiKey)
->set('auto_translation_api_deepl_mode', (bool) $form_state->getValue('auto_translation_api_deepl_mode'))
->set('auto_translation_api_deepl_pro_mode', (bool) $form_state->getValue('auto_translation_api_deepl_pro_mode'))
->set('auto_translation_excluded_fields', $excludedFields)
->set('auto_translation_provider', $provider)
->set('auto_translation_bulk_publish', Html::escape($form_state->getValue('auto_translation_bulk_publish')))
Loading