You are here

public function LingotekConfigSet::setMetadataValue in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.6 lib/Drupal/lingotek/LingotekConfigSet.php \LingotekConfigSet::setMetadataValue()

Sets a Lingotek metadata value for this item.

Parameters

string $key: The key for a name/value pair.

string $value: The value for a name/value pair.

Overrides LingotekTranslatableEntity::setMetadataValue

7 calls to LingotekConfigSet::setMetadataValue()
LingotekConfigSet::setDocumentId in lib/Drupal/lingotek/LingotekConfigSet.php
Assign the set's document ID in the config metadata table
LingotekConfigSet::setExclusiveTargetsStatus in lib/Drupal/lingotek/LingotekConfigSet.php
LingotekConfigSet::setLastError in lib/Drupal/lingotek/LingotekConfigSet.php
Assign the set's last sync error in the config metadata table
LingotekConfigSet::setProjectId in lib/Drupal/lingotek/LingotekConfigSet.php
Assign the set's project ID in the config metadata table
LingotekConfigSet::setStatus in lib/Drupal/lingotek/LingotekConfigSet.php
Assign the set's status in the config metadata table

... See full list

File

lib/Drupal/lingotek/LingotekConfigSet.php, line 799
Defines LingotekConfigSet.

Class

LingotekConfigSet
A class wrapper for Lingotek-specific behavior on ConfigSets.

Code

public function setMetadataValue($key, $value) {
  $metadata = $this
    ->metadata();
  $timestamp = time();
  if (!isset($metadata[$key])) {
    db_insert('lingotek_config_metadata')
      ->fields(array(
      'id' => $this->sid,
      'config_key' => $key,
      'value' => $value,
      'created' => $timestamp,
      'modified' => $timestamp,
    ))
      ->execute();
  }
  else {
    db_update('lingotek_config_metadata')
      ->fields(array(
      'value' => $value,
      'modified' => $timestamp,
    ))
      ->condition('id', $this->sid)
      ->condition('config_key', $key)
      ->execute();
  }
}