You are here

public function LingotekConfigSet::setMetadataValue in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 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

5 calls to LingotekConfigSet::setMetadataValue()
LingotekConfigSet::setDocumentId in lib/Drupal/lingotek/LingotekConfigSet.php
Assign the set's document ID in the config metadata table
LingotekConfigSet::setLastError in lib/Drupal/lingotek/LingotekConfigSet.php
Assign the set's last 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
LingotekConfigSet::setTargetsStatus in lib/Drupal/lingotek/LingotekConfigSet.php
Assign the set's target status(es) in the config metadata table

File

lib/Drupal/lingotek/LingotekConfigSet.php, line 746
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();
  }
}