function globallink_form_field_ui_field_edit_form_alter in GlobalLink Connect for Drupal 7.5
Same name and namespace in other branches
- 7.7 globallink.module \globallink_form_field_ui_field_edit_form_alter()
- 7.6 globallink.module \globallink_form_field_ui_field_edit_form_alter()
Implements hook_form_FORM_ID_alter().
File
- ./
globallink.module, line 752 - GlobalLink translation module.
Code
function globallink_form_field_ui_field_edit_form_alter(&$form, $form_state) {
module_load_include('inc', 'globallink', 'globallink');
$field_type = $form['#field']['type'];
switch ($field_type) {
case 'list_boolean':
case 'image':
case 'file':
case 'taxonomy_term_reference':
case 'field_collection':
break;
default:
$field_name = $form['#field']['field_name'];
$entity_type = $form['#instance']['entity_type'];
$bundle_name = $form['#instance']['bundle'];
if ($entity_type == 'field_collection_item') {
break;
}
if (!globallink_translation_supported($bundle_name)) {
break;
}
$translatable = globallink_is_field_configured_for_translation($entity_type, $bundle_name, $field_name, $bundle_name);
$label = t('GlobalLink Translation');
$title = t('This field can be translated using Translations.com translation services.');
$form['instance']['globallink_translate_field'] = array(
'#prefix' => '<label>' . $label . '</label>',
'#type' => 'checkbox',
'#title' => $title,
'#default_value' => $translatable ? 1 : 0,
);
}
$form['#submit'][] = 'globallink_form_field_ui_field_edit_form_submit';
}