1.20.x translation.module | translation_form_node_type_form_alter(&$form, &$form_state) |
Implements hook_form_FORM_ID_alter() for node_type_form().
File
- modules/
translation/ translation.module, line 128 - Manages content translations.
Code
function translation_form_node_type_form_alter(&$form, &$form_state) {
$node_type = $form['#node_type'];
// Add translation option to content type form.
$form['multilingual']['language']['#type'] = 'radios';
$form['multilingual']['language']['#options'] = array(
0 => t('Disabled'),
1 => t('Enabled'),
TRANSLATION_ENABLED => t('Enabled, with translation'),
);
$form['multilingual']['language'][0]['#description'] = t('New content will be created with no defined language.');
$form['multilingual']['language'][1]['#description'] = t('New content will have a language selection option listing all the <a href="@languages">enabled languages</a>.', array('@languages' => url('admin/config/regional/language')));
$form['multilingual']['language'][TRANSLATION_ENABLED]['#description'] = t('Content may be translated into any of the <a href="@languages">enabled languages</a>.', array('@languages' => url('admin/config/regional/language')));
// Description based on text from node.module.
$form['multilingual']['language']['#description'] = t('Existing content will not be affected by changing this option.');
$form['multilingual']['translation_show_links'] = array(
'#type' => 'checkbox',
'#title' => t('Show content translation links'),
'#description' => t('Show the links to translations in content body and teasers. If you uncheck this option, switching language will only be available from the language switcher block.'),
'#default_value' => (bool) $node_type->settings['translation_show_links'],
'#states' => array(
'visible' => array(
':input[name="language"]' => array('value' => TRANSLATION_ENABLED),
),
),
);
}