You are here

function node_translation_table_nodetype_filtered_form in Translation table 7

Same name and namespace in other branches
  1. 6 modules/node.translation_table.inc \node_translation_table_nodetype_filtered_form()

Form for node type translation. Note: If the node type is not in the locales_source table, then it won't be displayed.

Parameters

$languages: languages to translate to

$nodetype: 0: show all else: filter by node type

1 call to node_translation_table_nodetype_filtered_form()
node_translation_table_nodetype_form in modules/node.translation_table.inc
Menu callback; Admin form for node type translation.

File

modules/node.translation_table.inc, line 77
Provide translation table functionality for the node module.

Code

function node_translation_table_nodetype_filtered_form($languages, $nodetype) {
  $header = _translation_table_get_header($languages);
  switch ($nodetype) {
    case '0':
      $query = db_select('locales_source', 'ls');
      $query
        ->fields('ls', array(
        'lid',
        'source',
        'location',
      ))
        ->extend('PagerDefault')
        ->extend('TableSort')
        ->condition('ls.textgroup', 'node')
        ->orderByHeader($header)
        ->limit(50);
      $result = $query
        ->execute();
      break;
    default:
      $query = db_select('locales_source', 'ls');
      $query
        ->fields('ls', array(
        'lid',
        'source',
        'location',
      ))
        ->extend('PagerDefault')
        ->extend('TableSort')
        ->condition('ls.textgroup', 'taxonomy')
        ->condition('ls.location', 'node:type: ' . check_plain($nodetype) . ' %', 'LIKE')
        ->orderByHeader($header)
        ->limit(50);
      $result = $query
        ->execute();
      break;
  }
  $form['strings']['#tree'] = TRUE;
  $form['header'] = array(
    '#type' => 'value',
    '#value' => $header,
  );
  while ($source = $result
    ->fetch()) {
    if (drupal_strlen(trim($source->source)) > 0) {
      $form['strings'][$source->lid] = _translation_table_row($source, $languages);
    }
  }
  $form['languages'] = array(
    '#type' => 'value',
    '#value' => $languages,
  );
  $form['tt-submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $form['pager'] = array(
    '#markup' => theme('pager'),
  );
  $form['#theme'] = 'translation_table';
  return $form;
}