You are here

public function LingotekEntity::setTargetsStatus in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.5 lib/Drupal/lingotek/LingotekEntity.php \LingotekEntity::setTargetsStatus()
  2. 7.6 lib/Drupal/lingotek/LingotekEntity.php \LingotekEntity::setTargetsStatus()

Assign the entity's target status(es) in the config metadata table

Overrides LingotekTranslatableEntity::setTargetsStatus

File

lib/Drupal/lingotek/LingotekEntity.php, line 456
Defines LingotekEntity.

Class

LingotekEntity
A class wrapper for Lingotek-specific behavior on nodes.

Code

public function setTargetsStatus($status, $lingotek_locale = NULL) {
  if (is_array($lingotek_locale)) {
    foreach ($lingotek_locale as $ll) {
      $this
        ->setMetadataValue('target_sync_status_' . $ll, $status);
    }
  }
  elseif (is_string($lingotek_locale) && !empty($lingotek_locale)) {
    $this
      ->setMetadataValue('target_sync_status_' . $lingotek_locale, $status);
  }
  else {

    // set status for all available targets
    foreach ($this->language_targets as $lt) {
      $this
        ->setMetadataValue('target_sync_status_' . $lt, $status);
    }
  }
  return $this;
}