function i18n_node_form_node_type_form_alter in Internationalization 7
Implements hook_form_FORM_ID_alter().
File
- i18n_node/
i18n_node.module, line 414 - Internationalization (i18n) module - Node type handling
Code
function i18n_node_form_node_type_form_alter(&$form, &$form_state) {
if (isset($form['type'])) {
$disabled = !i18n_node_type_enabled($form['#node_type']);
$form['i18n'] = array(
'#type' => 'fieldset',
'#title' => t('Multilingual settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
'#attributes' => array(
'class' => array(
'i18n-node-type-settings-form',
),
),
'#description' => t('Extended multilingual options provided by Internationalization module.'),
'#disabled' => $disabled,
);
// Some settings about node languages. Add variables for node type from variable definition
if ($form['#node_type']->type) {
variable_type_include('node_type');
$form['i18n'] += node_variable_type_subform($form['#node_type']->type, array(
'i18n_node_options',
'i18n_node_default_language_for',
'i18n_node_extended',
));
// Only show custom default language field if "current" is checked.
$form['i18n']['i18n_node_default_language_for']['#states'] = array(
'visible' => array(
':input[name="i18n_node_options[current]"]' => array(
'checked' => TRUE,
),
),
'required' => array(
':input[name="i18n_node_options[current]"]' => array(
'checked' => TRUE,
),
),
);
}
// Add disabled message
if ($disabled) {
$form['i18n']['#description'] .= ' <em>' . t('These will be available only when you enable Multilingual support in Publishing options above.') . '</em>';
foreach (element_children($form['i18n']) as $key) {
$form['i18n'][$key]['#disabled'] = TRUE;
}
}
}
}