You are here

function node_translation_table_nodetype_filtered_form in Translation table 6

Same name and namespace in other branches
  1. 7 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':
      $sql = "SELECT ls.lid, ls.source, ls.location FROM {locales_source} ls WHERE ls.textgroup = 'nodetype'";
      $sql .= tablesort_sql($header);
      $result = pager_query($sql, 50, 0);
      break;
    default:
      $sql = "SELECT ls.lid, ls.source, ls.location FROM {locales_source} ls WHERE ls.textgroup = 'nodetype' AND ls.location LIKE 'type:%s%'";
      $sql .= tablesort_sql($header);
      $result = pager_query($sql, 50, 0, NULL, $nodetype);
      break;
  }
  $form['strings']['#tree'] = TRUE;
  $form['#cache'] = TRUE;
  $form['header'] = array(
    '#type' => 'value',
    '#value' => $header,
  );
  while ($source = db_fetch_object($result)) {
    if (strlen(trim($source->source)) > 0) {
      $form['strings'][$source->lid] = _translation_table_row($source, $languages);
    }
  }
  $form['languages'] = array(
    '#type' => 'value',
    '#value' => $languages,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $form['pager'] = array(
    '#value' => theme('pager', NULL, 50, 0),
  );
  $form['#theme'] = 'translation_table';
  return $form;
}