function translation_entity_enable_widget

Returns a widget to enable entity translation per entity bundle.

Backward compatibility layer to support entities not using the language configuration form element.

@todo Remove once all core entities have language configuration.

Parameters

string $entity_type: The type of the entity being configured for translation.

string $bundle: The bundle of the entity being configured for translation.

array $form: The configuration form array.

array $form_state: The configuration form state array.

2 calls to translation_entity_enable_widget()
comment_form_node_type_form_alter in drupal/core/modules/comment/comment.module
Implements hook_form_FORM_ID_alter().
user_admin_settings in drupal/core/modules/user/user.admin.inc
Form builder; Configure user settings for this site.

File

drupal/core/modules/translation_entity/translation_entity.module, line 641
Allows entities to be translated into different languages.

Code

function translation_entity_enable_widget($entity_type, $bundle, array &$form, array &$form_state) {
  $key = $form_state['translation_entity']['key'];
  if (!isset($form_state['language'][$key])) {
    $form_state['language'][$key] = array();
  }
  $form_state['language'][$key] += array(
    'entity_type' => $entity_type,
    'bundle' => $bundle,
  );
  $element = translation_entity_language_configuration_element_process(array(
    '#name' => $key,
  ), $form_state, $form);
  unset($element['translation_entity']['#element_validate']);
  return $element;
}