Problem/Motivation
We are trying to configure an additional Lionbridge provider in order for our editors to submit translation jobs that uses a different workflow. But we've run into several issues trying to configure an additional provider.
For example, in \Drupal\tmgmt_contentapi\ContentApiTranslatorUI::buildConfigurationForm
only the default provider config (that gets installed when you install the module) is loaded and updated, instead of the configuration entity the form is actually loading.
$tmpSettings = \Drupal::service('config.factory')->getEditable('tmgmt.translator.contentapi');
// A little bit further down in the same method...
$prevHost = $tmpSettings->get('settings.capi-settings.capi_host');
$tmpSettings->set('settings.capi-settings.capi_host',$capisettings["capi_host"]);
$tmpSettings->save();
This also means that if you'd remove the default provider and create a new one, the module would be totally broken.
Steps to reproduce
- Create an additional Lionbridge translation provider that uses a different lionbridge provider and/or host (we encountered this issue when configuring one provider that connected to the
contentapi.lionbridge.com/v2
and the other connected to
content-api.staging.lionbridge.com/v2
.
- Create a new translation job and change translation provider to the custom one
Proposed resolution
Find all instances were we assume a tmgmt.translator.contentapi
config entity exists and load the config from context instead.
For example instead of $tmpSettings = \Drupal::service('config.factory')->getEditable('tmgmt.translator.contentapi');
do $tmpSettings = $form_state->getFormObject()->getEntity();
.
Remaining tasks
User interface changes
API changes
Data model changes