function entity_translation_form_node_type_form_alter in Entity Translation 7
Implements hook_form_FORM_ID_alter().
Provides settings into the node content type form to choose for entity translation metadata and comment filtering.
File
- ./
entity_translation.node.inc, line 125 - The node specific translation functions and hook implementations.
Code
function entity_translation_form_node_type_form_alter(&$form, &$form_state) {
if (entity_translation_enabled('node')) {
$type = $form['#node_type']->type;
$t_args = array(
'!url' => url('admin/config/regional/entity_translation'),
);
$form['workflow']['language_content_type']['#options'][ENTITY_TRANSLATION_ENABLED] = t('Enabled, with field translation');
$form['workflow']['language_content_type']['#description'] .= ' <p>' . t('If field translation is selected you can have per-field translation for each available language. You can find more options in the <a href="!url">entity translation settings</a>.', $t_args) . '</p>';
// Hide settings when entity translation is disabled for this content type.
$states = array(
'visible' => array(
':input[name="language_content_type"]' => array(
'value' => ENTITY_TRANSLATION_ENABLED,
),
),
);
$form['workflow']['entity_translation_hide_translation_links'] = array(
'#type' => 'checkbox',
'#default_value' => variable_get("entity_translation_hide_translation_links_{$type}", FALSE),
'#title' => t('Hide content translation links'),
'#description' => t('Hide the links to translations in content body and teasers. If you choose this option, switching language will only be available from the language switcher block.'),
'#states' => $states,
);
$form['display']['entity_translation_node_metadata'] = array(
'#type' => 'radios',
'#title' => t('Translation post information'),
'#description' => t('Whether the translation authoring information should be hidden, shown, or replace the node\'s authoring information.'),
'#default_value' => variable_get("entity_translation_node_metadata_{$type}", ENTITY_TRANSLATION_METADATA_HIDE),
'#options' => array(
t('Hidden'),
t('Shown'),
t('Replacing post information'),
),
'#states' => $states,
);
if (isset($form['comment'])) {
$form['comment']['entity_translation_comment_filter'] = array(
'#type' => 'checkbox',
'#title' => t('Filter comments per language'),
'#default_value' => variable_get("entity_translation_comment_filter_{$type}", FALSE),
'#description' => t('Show only comments whose language matches content language.'),
'#states' => $states,
);
}
}
}