Commit 7b643482 authored by Kevin Paxman's avatar Kevin Paxman
Browse files

Merge branch 'feature/uw_ct_profile-ibiki-readonly-form-fields' into '8.x-1.x'

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

See merge request !6
parents 7ea65439 67496b25
......@@ -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