You are here

function _tmgmt_data_count_7006 in Translation Management Tool 7

Data parsing helper function for tmgmt_update_7006().

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_7006()
tmgmt_update_7006 in ./tmgmt.install
Set word count for existing job items.

File

./tmgmt.install, line 629
Installation hooks for the Translation Management module.

Code

function _tmgmt_data_count_7006($item, $entity) {
  if (!empty($item['#text'])) {
    if (_tmgmt_filter_data($item)) {
      module_load_include('module', 'tmgmt');

      // Count words of the data item.
      $entity->word_count += tmgmt_word_count($item['#text']);
    }
  }
  else {
    foreach (element_children($item) as $key) {
      _tmgmt_data_count_7006($item[$key], $entity);
    }
  }
}