Commit 08df7b0d authored by catch's avatar catch

Issue #552604 by sun, lambic, swentel, yched, Lukas von Blarer: Adding new...

Issue #552604 by sun, lambic, swentel, yched, Lukas von Blarer: Adding new fields leads to a confusing 'Field settings' form.
parent 4b9fec43
......@@ -213,8 +213,8 @@ function testOptionsAllowedValuesBoolean() {
'on' => $on,
'off' => $off,
);
$this->drupalPost($this->admin_path, $edit, t('Save settings'));
$this->assertText("Saved field_options_boolean configuration.", t("The 'On' and 'Off' form fields work for boolean fields."));
$this->drupalPost($this->admin_path, $edit, t('Save field settings'));
$this->assertRaw(t('Updated field %label field settings.', array('%label' => $this->field_name)));
// Test the allowed_values on the field settings form.
$this->drupalGet($this->admin_path);
$this->assertFieldByName('on', $on, t("The 'On' value is stored correctly."));
......@@ -245,7 +245,7 @@ protected function createOptionsField($type) {
);
field_create_instance($instance);
$this->admin_path = 'admin/structure/types/manage/' . $this->type . '/fields/' . $this->field_name;
$this->admin_path = 'admin/structure/types/manage/' . $this->type . '/fields/' . $this->field_name . '/field-settings';
}
/**
......@@ -262,7 +262,7 @@ protected function createOptionsField($type) {
*/
function assertAllowedValuesInput($input_string, $result, $message) {
$edit = array('field[settings][allowed_values]' => $input_string);
$this->drupalPost($this->admin_path, $edit, t('Save settings'));
$this->drupalPost($this->admin_path, $edit, t('Save field settings'));
if (is_string($result)) {
$this->assertText($result, $message);
......
......@@ -91,7 +91,7 @@ function testTextField() {
function testTextFieldFormatted() {
// Make node body multiple.
$edit = array('field[container][cardinality]' => -1);
$this->drupalPost('admin/structure/types/manage/article/fields/body', $edit, t('Save settings'));
$this->drupalPost('admin/structure/types/manage/article/fields/body/field-settings', $edit, t('Save field settings'));
$this->drupalGet('node/add/article');
$this->assertFieldByXPath("//input[@name='body_add_more']", t('Add another item'), 'Body field cardinality set to multiple.');
......
......@@ -555,6 +555,9 @@ function field_ui_field_settings_form($form, &$form_state, $instance) {
$bundle = $instance['bundle'];
$entity_type = $instance['entity_type'];
$field = field_info_field($instance['field_name']);
$form['#field'] = $field;
$form['#entity_type'] = $entity_type;
$form['#bundle'] = $bundle;
drupal_set_title($instance['label']);
......@@ -562,9 +565,7 @@ function field_ui_field_settings_form($form, &$form_state, $instance) {
// Create a form structure for the field values.
$form['field'] = array(
'#type' => 'details',
'#title' => t('Field settings'),
'#description' => $description,
'#prefix' => $description,
'#tree' => TRUE,
);
......@@ -572,7 +573,42 @@ function field_ui_field_settings_form($form, &$form_state, $instance) {
// If so, prevent changes to the field settings.
$has_data = field_has_data($field);
if ($has_data) {
$form['field']['#description'] = '<div class="messages error">' . t('There is data for this field in the database. The field settings can no longer be changed.') . '</div>' . $form['field']['#description'];
$form['field']['#prefix'] = '<div class="messages error">' . t('There is data for this field in the database. The field settings can no longer be changed.') . '</div>' . $form['field']['#prefix'];
}
// Build the configurable field values.
$cardinality = $field['cardinality'];
$form['field']['container'] = array(
// We can't use the container element because it doesn't support the title
// or description properties.
'#type' => 'item',
'#field_prefix' => '<div class="container-inline">',
'#field_suffix' => '</div>',
'#title' => t('Maximum number of values users can enter'),
);
$form['field']['container']['cardinality'] = array(
'#type' => 'select',
'#options' => drupal_map_assoc(range(1, 5)) + array(FIELD_CARDINALITY_UNLIMITED => t('Unlimited')) + array('other' => t('More')),
'#default_value' => ($cardinality < 6) ? $cardinality : 'other',
);
// @todo Convert when http://drupal.org/node/1207060 gets in.
$form['field']['container']['cardinality_other'] = array(
'#type' => 'number',
'#default_value' => $cardinality > 5 ? $cardinality : 6,
'#min' => 1,
'#title' => t('Custom value'),
'#title_display' => 'invisible',
'#states' => array(
'visible' => array(
':input[name="field[container][cardinality]"]' => array('value' => 'other'),
),
),
);
if (field_behaviors_widget('multiple values', $instance) == FIELD_BEHAVIOR_DEFAULT) {
$form['field']['container']['#description'] = t('%unlimited will provide an %add-more button so users can add as many values as they like.', array(
'%unlimited' => t('Unlimited'),
'%add-more' => t('Add another item'),
));
}
// Build the non-configurable field values.
......@@ -584,24 +620,38 @@ function field_ui_field_settings_form($form, &$form_state, $instance) {
// Add settings provided by the field module. The field module is
// responsible for not returning settings that cannot be changed if
// the field already has data.
$form['field']['settings'] = array();
$form['field']['settings'] = array(
'#weight' => 10,
);
$additions = module_invoke($field['module'], 'field_settings_form', $field, $instance, $has_data);
if (is_array($additions)) {
$form['field']['settings'] = $additions;
$form['field']['settings'] += $additions;
}
if (empty($form['field']['settings'])) {
$form['field']['settings'] = array(
if (!element_children($form['field']['settings'])) {
$form['field']['settings'] += array(
'#markup' => t('%field has no field settings.', array('%field' => $instance['label'])),
);
}
$form['#entity_type'] = $entity_type;
$form['#bundle'] = $bundle;
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array('#type' => 'submit', '#value' => t('Save field settings'));
return $form;
}
/**
* Form validation handler for field_ui_field_edit_form().
*
* @see field_ui_field_settings_form_submit().
*/
function field_ui_field_settings_form_validate($form, &$form_state) {
// Validate field cardinality.
$cardinality = $form_state['values']['field']['container']['cardinality'];
$cardinality_other = $form_state['values']['field']['container']['cardinality_other'];
if ($cardinality == 'other' && empty($cardinality_other)) {
form_error($form['field']['container']['cardinality_other'], t('Number of values is required.'));
}
}
/**
* Form submission handler for field_ui_field_settings_form().
*/
......@@ -609,6 +659,16 @@ function field_ui_field_settings_form_submit($form, &$form_state) {
$form_values = $form_state['values'];
$field_values = $form_values['field'];
// Save field cardinality.
$cardinality = $field_values['container']['cardinality'];
$cardinality_other = $field_values['container']['cardinality_other'];
$cardinality_other = $form_state['values']['field']['container']['cardinality_other'];
if ($cardinality == 'other') {
$cardinality = $cardinality_other;
}
$field_values['cardinality'] = $cardinality;
unset($field_values['container']);
// Merge incoming form values into the existing field.
$field = field_info_field($field_values['field_name']);
......@@ -656,8 +716,7 @@ function field_ui_widget_type_form($form, &$form_state, FieldInstance $instance)
);
$form['basic'] = array(
'#type' => 'details',
'#title' => t('Change widget'),
'#tree' => TRUE,
);
$form['basic']['widget_type'] = array(
'#type' => 'select',
......@@ -791,8 +850,12 @@ function field_ui_field_edit_form($form, &$form_state, $instance) {
$bundle = $instance['bundle'];
$entity_type = $instance['entity_type'];
$field = field_info_field($instance['field_name']);
$bundles = field_info_bundles();
drupal_set_title($instance['label']);
drupal_set_title(t('%instance settings for %bundle', array(
'%instance' => $instance['label'],
'%bundle' => $bundles[$entity_type][$bundle]['label'],
)), PASS_THROUGH);
$form['#field'] = $field;
$form['#instance'] = $instance;
......@@ -808,22 +871,11 @@ function field_ui_field_edit_form($form, &$form_state, $instance) {
return $form;
}
$field_type = field_info_field_types($field['type']);
$widget_type = field_info_widget_types($instance['widget']['type']);
$bundles = field_info_bundles();
// Create a form structure for the instance values.
$form['instance'] = array(
'#tree' => TRUE,
'#type' => 'details',
'#title' => t('%type settings', array('%type' => $bundles[$entity_type][$bundle]['label'])),
'#description' => t('These settings apply only to the %field field when used in the %type type.', array(
'%field' => $instance['label'],
'%type' => $bundles[$entity_type][$bundle]['label'],
)),
// Ensure field_ui_field_edit_instance_pre_render() gets called in addition
// to, not instead of, the #pre_render function(s) needed by all details.
'#pre_render' => array_merge(array('field_ui_field_edit_instance_pre_render'), element_info_property('details', '#pre_render', array())),
);
// Build the non-configurable instance values.
......@@ -887,78 +939,19 @@ function field_ui_field_edit_form($form, &$form_state, $instance) {
$additions = module_invoke($field['module'], 'field_instance_settings_form', $field, $instance);
if (is_array($additions)) {
$form['instance']['settings'] = $additions;
$form['instance']['settings']['#weight'] = 10;
}
// Add widget settings for the widget type.
$additions = $instance->getWidget()->settingsForm($form, $form_state);
$form['instance']['widget']['settings'] = $additions ? $additions : array('#type' => 'value', '#value' => array());
$form['instance']['widget']['#weight'] = 20;
// Add handling for default value if not provided by any other module.
if (field_behaviors_widget('default_value', $instance) == FIELD_BEHAVIOR_DEFAULT && empty($instance['default_value_function'])) {
$form['instance']['default_value_widget'] = field_ui_default_value_widget($field, $instance, $form, $form_state);
}
$has_data = field_has_data($field);
if ($has_data) {
$description = '<p>' . t('These settings apply to the %field field everywhere it is used. Because the field already has data, some settings can no longer be changed.', array('%field' => $instance['label'])) . '</p>';
}
else {
$description = '<p>' . t('These settings apply to the %field field everywhere it is used.', array('%field' => $instance['label'])) . '</p>';
}
// Create a form structure for the field values.
$form['field'] = array(
'#type' => 'details',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Global settings'),
'#description' => $description,
'#tree' => TRUE,
);
// Build the configurable field values.
$description = t('Maximum number of values users can enter for this field.');
if (field_behaviors_widget('multiple_values', $instance) == FIELD_BEHAVIOR_DEFAULT) {
$description .= '<br/>' . t("'Unlimited' will provide an 'Add more' button so the users can add as many values as they like.");
}
$cardinality = $field['cardinality'];
$form['field']['container'] = array(
// We can't use the container element because it doesn't support the title
// or description properties.
'#type' => 'item',
'#field_prefix' => '<div class="container-inline">',
'#field_suffix' => '</div>',
'#title' => t('Number of values'),
'#description' => $description,
);
$form['field']['container']['cardinality'] = array(
'#type' => 'select',
'#options' => array(FIELD_CARDINALITY_UNLIMITED => t('Unlimited')) + drupal_map_assoc(range(1, 5)) + array('other' => t('More')),
'#default_value' => ($cardinality < 6) ? $cardinality : 'other',
);
// @todo Convert when http://drupal.org/node/1207060 gets in.
$form['field']['container']['cardinality_other'] = array(
'#type' => 'number',
'#default_value' => $cardinality > 5 ? $cardinality : 6,
'#min' => 1,
'#title' => t('Custom value'),
'#title_display' => 'invisible',
'#states' => array(
'visible' => array(
':input[name="field[container][cardinality]"]' => array('value' => 'other'),
),
),
);
// Add additional field type settings. The field type module is
// responsible for not returning settings that cannot be changed if
// the field already has data.
$additions = module_invoke($field['module'], 'field_settings_form', $field, $instance, $has_data);
if (is_array($additions)) {
$form['field']['settings'] = $additions;
}
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
......@@ -985,36 +978,6 @@ function field_ui_field_edit_form_delete_submit($form, &$form_state) {
$form_state['redirect'] = array('admin/structure/types/manage/' . $instance['bundle'] . '/fields/' . $instance['field_name'] . '/delete', array('query' => $destination));
}
/**
* Render API callback: Merges instance, widget and other settings.
*
* Combines the instance, widget, and other settings into a single details so
* that elements within each group can be shown at different weights as if they
* all had the same parent.
*
* This function is assigned as a #pre_render callback in
* field_ui_field_edit_form().
*/
function field_ui_field_edit_instance_pre_render($element) {
// Merge the widget settings into the main form.
if (isset($element['widget']['settings'])) {
foreach (element_children($element['widget']['settings']) as $key) {
$element['widget_' . $key] = $element['widget']['settings'][$key];
}
unset($element['widget']['settings']);
}
// Merge the instance settings into the main form.
if (isset($element['settings'])) {
foreach (element_children($element['settings']) as $key) {
$element['instance_' . $key] = $element['settings'][$key];
}
unset($element['settings']);
}
return $element;
}
/**
* Builds the default value widget for a given field instance.
*/
......@@ -1059,13 +1022,6 @@ function field_ui_field_edit_form_validate($form, &$form_state) {
$field_name = $instance['field_name'];
$entity = $form['#entity'];
// Validate field cardinality.
$cardinality = $form_state['values']['field']['container']['cardinality'];
$cardinality_other = $form_state['values']['field']['container']['cardinality_other'];
if ($cardinality == 'other' && empty($cardinality_other)) {
form_error($form['field']['container']['cardinality_other'], t('Number of values is required.'));
}
if (isset($form['instance']['default_value_widget'])) {
$element = $form['instance']['default_value_widget'];
......@@ -1106,25 +1062,6 @@ function field_ui_field_edit_form_submit($form, &$form_state) {
$field = $form['#field'];
$entity = $form['#entity'];
// Save field cardinality.
$cardinality = $form_state['values']['field']['container']['cardinality'];
$cardinality_other = $form_state['values']['field']['container']['cardinality_other'];
if ($cardinality == 'other') {
$cardinality = $cardinality_other;
}
$form_state['values']['field']['cardinality'] = $cardinality;
unset($form_state['values']['field']['container']);
// Merge incoming values into the field.
$field = array_merge($field, $form_state['values']['field']);
try {
field_update_field($field);
}
catch (Exception $e) {
drupal_set_message(t('Attempt to update field %label failed: %message.', array('%label' => $instance['label'], '%message' => $e->getMessage())), 'error');
return;
}
// Handle the default value.
if (isset($form['instance']['default_value_widget'])) {
$element = $form['instance']['default_value_widget'];
......
......@@ -586,6 +586,8 @@ public function submit(array $form, array &$form_state) {
field_create_field($field);
field_create_instance($instance);
// Always show the field settings step, as the cardinality needs to be
// configured for new fields.
$destinations[] = $this->adminPath. '/fields/' . $field['field_name'] . '/field-settings';
$destinations[] = $this->adminPath . '/fields/' . $field['field_name'];
......@@ -618,7 +620,7 @@ public function submit(array $form, array &$form_state) {
try {
field_create_instance($instance);
$destinations[] = $this->adminPath . '/fields/' . $instance['field_name'] . '/edit';
$destinations[] = $this->adminPath . '/fields/' . $instance['field_name'];
// Store new field information for any additional submit handlers.
$form_state['fields_added']['_add_existing_field'] = $instance['field_name'];
}
......
......@@ -124,12 +124,18 @@ function createField() {
*/
function updateField() {
// Go to the field edit page.
$this->drupalGet('admin/structure/types/manage/' . $this->type . '/fields/' . $this->field_name);
$this->drupalGet('admin/structure/types/manage/' . $this->type . '/fields/' . $this->field_name . '/field-settings');
// Populate the field settings with new settings.
$string = 'updated dummy test string';
$edit = array(
'field[settings][test_field_setting]' => $string,
);
$this->drupalPost(NULL, $edit, t('Save field settings'));
// Go to the field instance edit page.
$this->drupalGet('admin/structure/types/manage/' . $this->type . '/fields/' . $this->field_name);
$edit = array(
'instance[settings][test_instance_setting]' => $string,
'instance[widget][settings][test_widget_setting]' => $string,
);
......@@ -139,7 +145,7 @@ function updateField() {
$this->assertFieldSettings($this->type, $this->field_name, $string);
// Assert redirection back to the "manage fields" page.
$this->assertText(t('Saved @label configuration.', array('@label' => $this->field_label)), 'Redirected to "Manage fields" page.');
$this->assertUrl('admin/structure/types/manage/' . $this->type . '/fields');
}
/**
......@@ -170,7 +176,7 @@ function addExistingField() {
* numeric value. That is tested already in FormTest::testNumber().
*/
function cardinalitySettings() {
$field_edit_path = 'admin/structure/types/manage/article/fields/body';
$field_edit_path = 'admin/structure/types/manage/article/fields/body/field-settings';
// Assert the cardinality other field cannot be empty when cardinality is
// set to other.
......@@ -178,7 +184,7 @@ function cardinalitySettings() {
'field[container][cardinality]' => 'other',
'field[container][cardinality_other]' => '',
);
$this->drupalPost($field_edit_path, $edit, t('Save settings'));
$this->drupalPost($field_edit_path, $edit, t('Save field settings'));
$this->assertText('Number of values is required.');
// Assert the cardinality field is set to 'Other' when the value is greater
......@@ -187,8 +193,8 @@ function cardinalitySettings() {
'field[container][cardinality]' => 'other',
'field[container][cardinality_other]' => 16,
);
$this->drupalPost($field_edit_path, $edit, t('Save settings'));
$this->assertText('Saved Body configuration.');
$this->drupalPost($field_edit_path, $edit, t('Save field settings'));
$this->assertText('Updated field Body field settings.');
$this->drupalGet($field_edit_path);
$this->assertFieldByXPath("//select[@name='field[container][cardinality]']", 'other');
$this->assertFieldByXPath("//input[@name='field[container][cardinality_other]']", 16);
......@@ -199,8 +205,8 @@ function cardinalitySettings() {
'field[container][cardinality]' => 3,
'field[container][cardinality_other]' => 16,
);
$this->drupalPost($field_edit_path, $edit, t('Save settings'));
$this->assertText('Saved Body configuration.');
$this->drupalPost($field_edit_path, $edit, t('Save field settings'));
$this->assertText('Updated field Body field settings.');
$this->drupalGet($field_edit_path);
$this->assertFieldByXPath("//select[@name='field[container][cardinality]']", 3);
$this->assertFieldByXPath("//input[@name='field[container][cardinality_other]']", 6);
......
......@@ -218,7 +218,7 @@ function testPrivateFileSetting() {
// Change the field setting to make its files private, and upload a file.
$edit = array('field[settings][uri_scheme]' => 'private');
$this->drupalPost("admin/structure/types/manage/$type_name/fields/$field_name", $edit, t('Save settings'));
$this->drupalPost("admin/structure/types/manage/$type_name/fields/$field_name/field-settings", $edit, t('Save field settings'));
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, TRUE);
$node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
......@@ -230,12 +230,12 @@ function testPrivateFileSetting() {
// Ensure we can't change 'uri_scheme' field settings while there are some
// entities with uploaded files.
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_name");
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_name/field-settings");
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and @disabled="disabled"]', 'public', t('Upload destination setting disabled.'));
// Delete node and confirm that setting could be changed.
node_delete($nid);
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_name");
$this->drupalGet("admin/structure/types/manage/$type_name/fields/$field_name/field-settings");
$this->assertFieldByXpath('//input[@id="edit-field-settings-uri-scheme-public" and not(@disabled)]', 'public', t('Upload destination setting enabled.'));
}
......
......@@ -70,9 +70,8 @@ function testDefaultImages() {
field_create_instance($instance2);
$instance2 = field_info_instance('node', $field_name, 'page');
// Confirm the defaults are present on the article field admin form.
$this->drupalGet("admin/structure/types/manage/article/fields/$field_name");
// Confirm the defaults are present on the article field settings form.
$this->drupalGet("admin/structure/types/manage/article/fields/$field_name/field-settings");
$this->assertFieldByXpath(
'//input[@name="field[settings][default_image][fid]"]',
$default_images['field']->fid,
......@@ -81,6 +80,8 @@ function testDefaultImages() {
array('@fid' => $default_images['field']->fid)
)
);
// Confirm the defaults are present on the article field edit form.
$this->drupalGet("admin/structure/types/manage/article/fields/$field_name");
$this->assertFieldByXpath(
'//input[@name="instance[settings][default_image][fid]"]',
$default_images['instance']->fid,
......@@ -90,8 +91,8 @@ function testDefaultImages() {
)
);
// Confirm the defaults are present on the page field admin form.
$this->drupalGet("admin/structure/types/manage/page/fields/$field_name");
// Confirm the defaults are present on the page field settings form.
$this->drupalGet("admin/structure/types/manage/page/fields/$field_name/field-settings");
$this->assertFieldByXpath(
'//input[@name="field[settings][default_image][fid]"]',
$default_images['field']->fid,
......@@ -100,6 +101,8 @@ function testDefaultImages() {
array('@fid' => $default_images['field']->fid)
)
);
// Confirm the defaults are present on the page field edit form.
$this->drupalGet("admin/structure/types/manage/page/fields/$field_name");
$this->assertFieldByXpath(
'//input[@name="instance[settings][default_image][fid]"]',
$default_images['instance2']->fid,
......@@ -137,8 +140,8 @@ function testDefaultImages() {
$field['settings']['default_image'] = $default_images['field_new']->fid;
field_update_field($field);
// Confirm that the new field default is used on the article admin form.
$this->drupalGet("admin/structure/types/manage/article/fields/$field_name");
// Confirm that the new default is used on the article field settings form.
$this->drupalGet("admin/structure/types/manage/article/fields/$field_name/field-settings");
$this->assertFieldByXpath(
'//input[@name="field[settings][default_image][fid]"]',
$default_images['field_new']->fid,
......
......@@ -222,7 +222,7 @@ function testImageFieldDefaultImage() {
$edit = array(
'files[field_settings_default_image]' => drupal_realpath($images[0]->uri),
);
$this->drupalPost('admin/structure/types/manage/article/fields/' . $field_name, $edit, t('Save settings'));
$this->drupalPost("admin/structure/types/manage/article/fields/$field_name/field-settings", $edit, t('Save field settings'));
// Clear field info cache so the new default image is detected.
field_info_cache_clear();
$field = field_info_field($field_name);
......@@ -250,7 +250,7 @@ function testImageFieldDefaultImage() {
$edit = array(
'field[settings][default_image][fid]' => 0,
);
$this->drupalPost('admin/structure/types/manage/article/fields/' . $field_name, $edit, t('Save settings'));
$this->drupalPost("admin/structure/types/manage/article/fields/$field_name/field-settings", $edit, t('Save field settings'));
// Clear field info cache so the new default image is detected.
field_info_cache_clear();
$field = field_info_field($field_name);
......@@ -263,7 +263,7 @@ function testImageFieldDefaultImage() {
$edit = array(
'files[field_settings_default_image]' => drupal_realpath($images[1]->uri),
);
$this->drupalPost('admin/structure/types/manage/article/fields/' . $private_field_name, $edit, t('Save settings'));
$this->drupalPost('admin/structure/types/manage/article/fields/' . $private_field_name . '/field-settings', $edit, t('Save field settings'));
$private_field = field_info_field($private_field_name);
$image = file_load($private_field['settings']['default_image']);
$this->assertEqual('private', file_uri_scheme($image->uri), 'Default image uses private:// scheme.');
......
......@@ -574,23 +574,18 @@ function translation_entity_field_extra_fields() {
/**
* Implements hook_form_FORM_ID_alter().
*/
function translation_entity_form_field_ui_field_edit_form_alter(array &$form, array &$form_state, $form_id) {
function translation_entity_form_field_ui_field_settings_form_alter(array &$form, array &$form_state, $form_id) {
$field = $form['#field'];
$field_name = $field['field_name'];
$translatable = $field['translatable'];
$label = t('Field translation');
$title = t('Users may translate this field.');
$form['field']['#collapsed'] = $translatable;
if (field_has_data($field)) {
$path = "admin/config/regional/translation_entity/translatable/$field_name";
$status = $translatable ? $title : t('This field has data in existing content.');
$link_title = !$translatable ? t('Enable translation') : t('Disable translation');
$form['field']['translatable'] = array(
'#prefix' => '<div class="translatable"><label>' . $label . '</label>',
'#suffix' => '</div>',
'message' => array(
'#markup' => $status . ' ',
),
......@@ -605,7 +600,6 @@ function translation_entity_form_field_ui_field_edit_form_alter(array &$form, ar
}
else {
$form['field']['translatable'] = array(
'#prefix' => '<label>' . $label . '</label>',
'#type' => 'checkbox',
'#title' => $title,
'#default_value' => $translatable,
......