LingotekWorkbenchModerationConfigurationService.php in Lingotek Translation 3.1.x
File
src/Moderation/LingotekWorkbenchModerationConfigurationService.php
View source
<?php
namespace Drupal\lingotek\Moderation;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
class LingotekWorkbenchModerationConfigurationService implements LingotekModerationConfigurationServiceInterface {
use LingotekWorkbenchModerationCheckTrait;
protected $configFactory;
public function __construct(ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory) {
$this
->setModuleHandler($module_handler);
$this->configFactory = $config_factory;
}
public function getUploadStatus($entity_type_id, $bundle) {
$config = $this->configFactory
->get('lingotek.settings');
$upload_status = $config
->get('translate.entity.' . $entity_type_id . '.' . $bundle . '.workbench_moderation.upload_status');
return $upload_status;
}
public function getDownloadTransition($entity_type_id, $bundle) {
$config = $this->configFactory
->get('lingotek.settings');
$download_transition = $config
->get('translate.entity.' . $entity_type_id . '.' . $bundle . '.workbench_moderation.download_transition');
return $download_transition;
}
public function setUploadStatus($entity_type_id, $bundle, $status) {
$config = $this->configFactory
->getEditable('lingotek.settings');
$config
->set('translate.entity.' . $entity_type_id . '.' . $bundle . '.workbench_moderation.upload_status', $status);
$config
->save();
return $status;
}
public function setDownloadTransition($entity_type_id, $bundle, $transition) {
$config = $this->configFactory
->getEditable('lingotek.settings');
$config
->set('translate.entity.' . $entity_type_id . '.' . $bundle . '.workbench_moderation.download_transition', $transition);
$config
->save();
return $transition;
}
}