When the default language is not neutral the title autocomplete in profile node edit/add does not work. This is because the JS in module phase2_profile targets the first and last name with hard coded id's, and as long as the site has neutral languages it works fine, but when switch to another, it fails.
The change basically allows to some flexibility in that regard by passing a prebuilt Id to the JS.

Here are some of the changes:

     var sources = {
-      firstname: $('#edit-field-profile-first-name-und-0-value', context).addClass('display-name-source'),
-      lastname: $('#edit-field-profile-last-name-und-0-value', context).addClass('display-name-source'),
-      orgname: $('#edit-field-profile-organization-und-0-value', context).addClass('display-name-source'),
+      firstname: $(firstname, context).addClass('display-name-source'),
+      lastname: $(lastname, context).addClass('display-name-source'),
+      orgname: $(orgname, context).addClass('display-name-source'),
     }

This is how it is built in PHP

+    $lang = $form[$field_name]['#language'];
+    $field_id = '#edit-' . str_replace('_', '-', $form[$field_name][$lang][0]['value']['#field_name']) . '-' . $lang . '-0' . '-value';
+    $settings[$js_var_name] = $field_id;

Comments

e2thex’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit f499b5c on master, 7.x-1.x, 7.x-1.0.4, 7.x-1.0.5, 7.x-1.0.4.2, 7.x-1.0.5-module-updates, 7.x-1.0.5.1, removepassword, appify_services, 7.x-2060595, 7.x-1.x-2093259-field_clean_up, appify authored by fxarte, committed by e2thex:
    issue #1598868 by fxarte: title not populated on language enable pages