function _tmgmt_data_count_7003 in Translation Management Tool 7
Data parsing helper function for tmgmt_update_7003().
Copied from TMGMTJobItemController::count().
Parameters
$item: The current data item.
$entity: The job item the count should be calculated.
1 call to _tmgmt_data_count_7003()
- tmgmt_update_7003 in ./
tmgmt.install - Set counters for existing job items.
File
- ./
tmgmt.install, line 491 - Installation hooks for the Translation Management module.
Code
function _tmgmt_data_count_7003(&$item, $entity) {
if (!empty($item['#text'])) {
if (_tmgmt_filter_data($item)) {
// Set default states if no state is set.
if (!isset($item['#status'])) {
// Translation is present.
if (!empty($item['#translation'])) {
$item['#status'] = TMGMT_DATA_ITEM_STATE_TRANSLATED;
}
else {
$item['#status'] = TMGMT_DATA_ITEM_STATE_PENDING;
}
}
switch ($item['#status']) {
case 1:
$entity->count_approved++;
break;
case 2:
$entity->count_translated++;
break;
default:
$entity->count_pending++;
break;
}
}
}
else {
foreach (element_children($item) as $key) {
_tmgmt_data_count_7003($item[$key], $entity);
}
}
}