This bug is the likely cause of at least one of the 23 test failures in translation.module; hopefully most of them. #666266: HEAD is broken - various test failures

/**
 * Implements hook_form_FORM_ID_alter().
 */
function translation_form_node_type_form_alter(&$form, &$form_state) {
  // Add translation option to content type form.
  $form['workflow']['language_content_type']['#options'][TRANSLATION_ENABLED] = t('Enabled, with translation');
  // Description based on text from locale.module.
  $form['workflow']['language_content_type']['#description'] = t('Enable multilingual support for this content type. I\
f enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a hre\
f="!languages">enabled languages</a>. You can also turn on translation for this content type, which lets you have cont\
ent translated to any of the enabled languages. If disabled, new posts are saved with the default language. Existing c\
ontent will not be affected by changing this option.', array('!languages' => url('admin/config/regional/language')));
}

Printing out the form array with debug() reveals that there is no such thing as a "language_content_type" field in the workflow fieldset, meaning the stuff that is inserted here doesn't actually do anything. Investigation shows that this field was meant to be added in locale.module's implementation of the same alter hook.

/**
 * Implements hook_form_FORM_ID_alter().
 */
function locale_form_node_type_form_alter(&$form, &$form_state) {
  if (isset($form['identity']['type'])) {
    $form['workflow']['language_content_type'] = array(
      '#type' => 'radios',
      '#title' => t('Multilingual support'),
      '#default_value' => variable_get('language_content_type_' . $form['#node_type']->type, 0),
      '#options' => array(t('Disabled'), t('Enabled')),
      '#description' => t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a href="!languages">enabled languages</a>. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/config/regional/language'))),
    );
  }
}

This alter hook does get called, but $form['identity']['type'] is not set.

These array keys exist in the form array:

#node_type, name, type, description, additional_settings, submission, workflow, display, 
old_type, orig_type, base, custom, modified, locked, submit, delete, #form_id, #build_id, 
#type, form_build_id, #token, form_token, form_id, #id, #method, #action, #theme_wrappers,
#after_build, #tree, #parents, #validate, #submit

I'm not sure what "[identity][type]" is meant to contain. Perhaps this is supposed to be "[#node_type]"?

Comments

cburschka’s picture

cburschka’s picture

Status: Active » Closed (duplicate)

Since the fix-up patch should probably be committed in the same issue, this one is now a duplicate.