You are here

function lingotek_bulk_grid_query_add_entity_specifics in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.bulk_grid.inc \lingotek_bulk_grid_query_add_entity_specifics()
1 call to lingotek_bulk_grid_query_add_entity_specifics()
lingotek_bulk_grid_query in ./lingotek.bulk_grid.inc

File

./lingotek.bulk_grid.inc, line 1333

Code

function lingotek_bulk_grid_query_add_entity_specifics($query, $entity_type, $bundle_col, $info) {
  if ($entity_type == 'comment') {
    $query
      ->join('node', 'nn', 'nn.nid = n.nid');
    $query
      ->addExpression("CONCAT('comment_node_',nn.type)", 'type');
    $query
      ->addExpression("CONCAT('comment_node_',nn.type)", 'node_type');
  }
  elseif ($entity_type == 'taxonomy_term') {
    $query
      ->addField('n', 'description');
    $query
      ->innerJoin('taxonomy_vocabulary', 'tv', 'n.vid = tv.vid');
    $query
      ->addField('tv', 'name', 'tv_name');
    $query
      ->addField('tv', 'machine_name', 'type');
    $query
      ->addField('tv', 'i18n_mode', 'translation_mode');

    // Remove taxonomy terms handled by config manage page.
    $query
      ->leftJoin('field_config_instance', 'fields', 'fields.bundle = tv.machine_name');
    $or = db_or();

    // Has no custom fields
    $or
      ->isNotNull('fields.bundle');
    $or
      ->condition('tv.i18n_mode', LINGOTEK_TAXONOMY_LOCALIZE_VALUE, '<>');
    $query
      ->condition($or);
  }
  elseif ($bundle_col) {
    if ($info['entity keys']['bundle'] != 'type') {
      $query
        ->addField('n', $info['entity keys']['bundle']);
    }
    $query
      ->addField('n', $info['entity keys']['bundle'], 'type');
  }
}