Commit 67496b25 authored by Igor Biki's avatar Igor Biki Committed by Kevin Paxman
Browse files

Set read only when updating existing profile with link to contact.

parent 7ea65439
......@@ -21,7 +21,8 @@ function uw_ct_profile_form_node_uw_ct_profile_form_alter(&$form, FormStateInter
// Apply readonly to fields only when link with contact field has contact
// entity referenced.
if (!empty($form_state->getValue('field_uw_ct_profile_contact')[0]['target_id'])) {
if (!empty($form_state->getValue('field_uw_ct_profile_contact')[0]['target_id']) ||
!empty($form['field_uw_ct_profile_contact']['widget'][0]['target_id']['#default_value'])) {
foreach (_uw_ct_profile_alter_fields() as $profile_field => $contact_field) {
$form[$profile_field]['widget'][0]['value']['#attributes']['readonly'] = 'readonly';
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment