You are here

function translation_node_overview in Internationalization 5

Same name and namespace in other branches
  1. 5.3 translation/translation.module \translation_node_overview()
  2. 5.2 translation/translation.module \translation_node_overview()

Shows overview of current translations plus remove button

Parameters

$node: Node to show translations for

$languages: Alternate list of languages

1 call to translation_node_overview()
translation_node_page in translation/translation.module
This is the callback for the tab 'translation' for nodes

File

translation/translation.module, line 699

Code

function translation_node_overview($node) {
  $languages = i18n_node_language_list($node);
  unset($languages[$node->language]);

  // $output = t('<h2>Current translations</h2>');
  $header = array(
    t('Language'),
    t('Title'),
    t('Status'),
    t('Options'),
  );

  // Special links for product nodes
  $createlink = $node->type == 'product' ? "node/add/{$node->type}/{$node->ptype}" : "node/add/{$node->type}";
  foreach ($languages as $lang => $langname) {
    $options = array();
    if (isset($node->translation[$lang])) {
      $trnode = $node->translation[$lang];
      $title = l($trnode->title, 'node/' . $trnode->nid);
      $status = $trnode->status ? t('Published') : t('Not published');
    }
    else {
      $title = t('Not translated');
      $options[] = l(t('create translation'), $createlink, array(), "translation={$node->nid}&language={$lang}");
      $status = '--';
    }
    $options[] = l(t('select node'), "node/{$node->nid}/translation/select/{$lang}");
    $rows[] = array(
      $langname,
      $title,
      $status,
      implode(" | ", $options),
    );
  }
  $output .= theme('table', $header, $rows);
  if ($node->trid) {
    $output .= drupal_get_form('translation_node_remove', $node);
  }
  return theme('box', t('Current translations'), $output);
}