public function LingotekConfigChunk::setMetadataValue in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.3 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::setMetadataValue()
- 7.5 lib/Drupal/lingotek/LingotekConfigChunk.php \LingotekConfigChunk::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
4 calls to LingotekConfigChunk::setMetadataValue()
- LingotekConfigChunk::setChunkStatus in lib/
Drupal/ lingotek/ LingotekConfigChunk.php - Set the chunk's status in the config metadata table
- LingotekConfigChunk::setChunkTargetsStatus in lib/
Drupal/ lingotek/ LingotekConfigChunk.php - Set the chunk's target status(es) in the config metadata table
- LingotekConfigChunk::setDocumentId in lib/
Drupal/ lingotek/ LingotekConfigChunk.php - Set the chunk's document ID in the config metadata table
- LingotekConfigChunk::setProjectId in lib/
Drupal/ lingotek/ LingotekConfigChunk.php - Set the chunk's project ID in the config metadata table
File
- lib/
Drupal/ lingotek/ LingotekConfigChunk.php, line 610 - Defines LingotekConfigChunk.
Class
- LingotekConfigChunk
- A class wrapper for Lingotek-specific behavior on ConfigChunks.
Code
public function setMetadataValue($key, $value) {
$metadata = $this
->metadata();
if (!isset($metadata[$key])) {
db_insert('lingotek_config_metadata')
->fields(array(
'id' => $this->cid,
'config_key' => $key,
'value' => $value,
))
->execute();
}
else {
db_update('lingotek_config_metadata')
->fields(array(
'value' => $value,
))
->condition('id', $this->cid)
->condition('config_key', $key)
->execute();
}
}