public function TMGMTJobItem::updateData in Translation Management Tool 7
Updates the values for a specific substructure in the data array.
The values are either set or updated but never deleted.
Parameters
$key: Key pointing to the item the values should be applied. The key can be either be an array containing the keys of a nested array hierarchy path or a string with '][' or '|' as delimiter.
$values: Nested array of values to set.
2 calls to TMGMTJobItem::updateData()
- TMGMTJobItem::addTranslatedDataRecursive in entity/
tmgmt.entity.job_item.inc - Recursively writes translated data to the data array of a job item.
- TMGMTJobItem::dataItemRevert in entity/
tmgmt.entity.job_item.inc - Reverts data item translation to the latest existing revision.
File
- entity/
tmgmt.entity.job_item.inc, line 683
Class
- TMGMTJobItem
- Entity class for the tmgmt_job entity.
Code
public function updateData($key, $values = array()) {
foreach ($values as $index => $value) {
// In order to preserve existing values, we can not aplly the values array
// at once. We need to apply each containing value on its own.
// If $value is an array we need to advance the hierarchy level.
if (is_array($value)) {
$this
->updateData(array_merge(tmgmt_ensure_keys_array($key), array(
$index,
)), $value);
}
else {
drupal_array_set_nested_value($this->data, array_merge(tmgmt_ensure_keys_array($key), array(
$index,
)), $value);
}
}
}