You are here

class LingotekWorkbenchModerationConfigurationService in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8.2 src/Moderation/LingotekWorkbenchModerationConfigurationService.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService
  2. 4.0.x src/Moderation/LingotekWorkbenchModerationConfigurationService.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService
  3. 3.1.x src/Moderation/LingotekWorkbenchModerationConfigurationService.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService
  4. 3.2.x src/Moderation/LingotekWorkbenchModerationConfigurationService.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService
  5. 3.3.x src/Moderation/LingotekWorkbenchModerationConfigurationService.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService
  6. 3.5.x src/Moderation/LingotekWorkbenchModerationConfigurationService.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService
  7. 3.6.x src/Moderation/LingotekWorkbenchModerationConfigurationService.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService
  8. 3.7.x src/Moderation/LingotekWorkbenchModerationConfigurationService.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService
  9. 3.8.x src/Moderation/LingotekWorkbenchModerationConfigurationService.php \Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService

Manages workbench moderation settings in the Lingotek integration.

@package Drupal\lingotek\Moderation

Hierarchy

Expanded class hierarchy of LingotekWorkbenchModerationConfigurationService

1 string reference to 'LingotekWorkbenchModerationConfigurationService'
lingotek.services.yml in ./lingotek.services.yml
lingotek.services.yml
1 service uses LingotekWorkbenchModerationConfigurationService
lingotek.workbench_moderation_configuration in ./lingotek.services.yml
Drupal\lingotek\Moderation\LingotekWorkbenchModerationConfigurationService

File

src/Moderation/LingotekWorkbenchModerationConfigurationService.php, line 13

Namespace

Drupal\lingotek\Moderation
View source
class LingotekWorkbenchModerationConfigurationService implements LingotekModerationConfigurationServiceInterface {
  use LingotekWorkbenchModerationCheckTrait;

  /**
   * The config factory service.
   *
   * @var \Drupal\Core\Config\ConfigFactoryInterface
   */
  protected $configFactory;

  /**
   * Constructs a new LingotekWorkbenchModerationConfigurationService object.
   *
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   */
  public function __construct(ModuleHandlerInterface $module_handler, ConfigFactoryInterface $config_factory) {
    $this
      ->setModuleHandler($module_handler);
    $this->configFactory = $config_factory;
  }

  /**
   * {@inheritdoc}
   */
  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;
  }

  /**
   * {@inheritdoc}
   */
  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;
  }

  /**
   * {@inheritdoc}
   */
  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;
  }

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LingotekWorkbenchModerationCheckTrait::$moduleHandler protected property The module handler service.
LingotekWorkbenchModerationCheckTrait::applies public function
LingotekWorkbenchModerationCheckTrait::setModuleHandler public function
LingotekWorkbenchModerationConfigurationService::$configFactory protected property The config factory service.
LingotekWorkbenchModerationConfigurationService::getDownloadTransition public function Gets the moderation transition ID that triggers a download. Overrides LingotekModerationConfigurationServiceInterface::getDownloadTransition
LingotekWorkbenchModerationConfigurationService::getUploadStatus public function Gets the moderation status ID that triggers an upload. Overrides LingotekModerationConfigurationServiceInterface::getUploadStatus
LingotekWorkbenchModerationConfigurationService::setDownloadTransition public function Sets the moderation transition ID that triggers a download. Overrides LingotekModerationConfigurationServiceInterface::setDownloadTransition
LingotekWorkbenchModerationConfigurationService::setUploadStatus public function Sets the moderation status ID that triggers an upload. Overrides LingotekModerationConfigurationServiceInterface::setUploadStatus
LingotekWorkbenchModerationConfigurationService::__construct public function Constructs a new LingotekWorkbenchModerationConfigurationService object.