0

Something along the lines of this

function THEME_AMENDS_form_alter(&$form, &$form_state, $form_id) {
   global $language;
   $lang = $language->language;
   $translations = translation_node_get_translations($base_node->tnid);
   $translated_node = (isset($translations[$lang])?node_load($translations[$lang]->nid):$base_node);
}

I want on the backend of the translated node above the form the english node title to be printed for reference only.

So say we have a contact page, I want on the (spanish) node in the backend above the content edit form "Page Title: Contact" to be printed above where the field for the translated title of the spanish node would be in which the user would translate the title to "contacto".

Basic layout below:

Page Title: Contact

Node title field: [Contacto] <-- input box

1 Answer 1

0

Soluton

if($form_id == 'content_page_node_form') {
    $nid = (isset($form['nid']['#value'])) ? $form['nid']['#value'] : false;
    if($nid) {
        $node = node_load($nid);

        if($node) {
            $lang = 'en';
            $translations = translation_node_get_translations($node->tnid);
            $translated_node = (isset($translations[$lang])) ? node_load($translations[$lang]->nid) : $node;
            $translated_title = '<h3>English Translation: ' . $translated_node->title . '</h3>';
        }
    }

    $form['#prefix'] = (isset($translated_title) && $translated_node->title != $node->title) ? $translated_title : '';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.