You are here

public function LingotekConfigTranslationService::setTargetStatus in Lingotek Translation 8

Same name and namespace in other branches
  1. 8.2 src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  2. 4.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  3. 3.0.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  4. 3.1.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  5. 3.2.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  6. 3.3.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  7. 3.4.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  8. 3.5.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  9. 3.6.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  10. 3.7.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()
  11. 3.8.x src/LingotekConfigTranslationService.php \Drupal\lingotek\LingotekConfigTranslationService::setTargetStatus()

Sets the translation status of a given entity translation for a locale.

Parameters

ConfigEntityInterface &$entity: The entity which status we want to change.

string $locale: Lingotek translation language which we want to modify.

int $status: Status of the translation. Use Lingotek constants.

bool $save: If FALSE, the entity is not saved yet. Defaults to TRUE.

Return value

ConfigEntityInterface

Overrides LingotekConfigTranslationServiceInterface::setTargetStatus

7 calls to LingotekConfigTranslationService::setTargetStatus()
LingotekConfigTranslationService::addTarget in src/LingotekConfigTranslationService.php
Request a translation for a given entity in the given locale.
LingotekConfigTranslationService::checkTargetStatus in src/LingotekConfigTranslationService.php
Checks the status of the translation in the Lingotek service.
LingotekConfigTranslationService::checkTargetStatuses in src/LingotekConfigTranslationService.php
Checks the status of all the translations in the Lingotek service.
LingotekConfigTranslationService::downloadDocument in src/LingotekConfigTranslationService.php
Downloads a document from the Lingotek service for a given locale.
LingotekConfigTranslationService::markTranslationsAsDirty in src/LingotekConfigTranslationService.php
Marks the translation status as dirty if they exist.

... See full list

File

src/LingotekConfigTranslationService.php, line 242
Contains \Drupal\lingotek\LingotekConfigTranslationService.

Class

LingotekConfigTranslationService
Service for managing Lingotek configuration translations.

Namespace

Drupal\lingotek

Code

public function setTargetStatus(ConfigEntityInterface &$entity, $langcode, $status, $save = TRUE) {
  $metadata = LingotekConfigMetadata::loadByConfigName($entity
    ->getEntityTypeId() . '.' . $entity
    ->id());
  $translation_status = $metadata
    ->getTargetStatus();
  $translation_status[$langcode] = $status;
  $metadata
    ->setTargetStatus($translation_status);
  if ($save) {
    $metadata
      ->save();
  }
  return $entity;
}