You are here

function translation_node_form in Internationalization 5.2

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

Form builder function

1 string reference to 'translation_node_form'
translation_node_select in translation/translation.module
Form to select a translation from existing nodes

File

translation/translation.module, line 464

Code

function translation_node_form($node, $lang, $list) {
  $form['node'] = array(
    '#type' => 'value',
    '#value' => $node,
  );
  $form['language'] = array(
    '#type' => 'hidden',
    '#value' => $lang,
  );
  $form['source_nid'] = array(
    '#type' => 'hidden',
    '#value' => $node->nid,
  );
  $form['trid'] = array(
    '#type' => 'hidden',
    '#value' => $node->trid,
  );
  $languages = i18n_node_language_list($node);
  $form['select'] = array(
    '#type' => 'fieldset',
    '#title' => t('Select translation for %language', array(
      '%language' => $languages[$lang],
    )),
  );
  $form['select']['lookup'] = array(
    '#type' => 'textfield',
    '#title' => t('Search for node'),
    '#description' => t('Enter node id or title'),
    '#size' => 80,
    '#maxlength' => 254,
    '#autocomplete_path' => 'translation/autocomplete/' . $lang,
  );
  $form['select']['nodes']['nid'] = array(
    '#type' => 'radios',
    '#title' => t('Or select from the list'),
    '#default_value' => isset($node->translation[$lang]) ? $node->translation[$lang]->nid : '',
    '#options' => $list,
  );
  $form['select']['pager'] = array(
    '#value' => theme('pager'),
  );
  $form['select']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}