You are here

function tmgmt_local_task_handler_field_wordcount::pre_render in Translation Management Tool 7

Prefetch statistics for all jobs.

Overrides views_handler_field_entity::pre_render

File

translators/tmgmt_local/views/handlers/tmgmt_local_task_handler_field_wordcount.inc, line 13

Class

tmgmt_local_task_handler_field_wordcount
Field handler which shows the word count.

Code

function pre_render(&$values) {
  parent::pre_render($values);

  // In case of jobs, pre-fetch the statistics in a single query and add them
  // to the static cache.
  if ($this->entity_type == 'tmgmt_task') {
    $tltids = array();
    foreach ($values as $value) {
      $tltids[] = $value->tjid;
    }
    tmgmt_local_task_statistics_load($tltids);
  }
}