Commit e7c97fea authored by Igor Biki's avatar Igor Biki
Browse files

Update to form alter to check form_state instead of form for existing values.

parent fe3be55b
......@@ -19,7 +19,8 @@ function uw_ct_profile_form_node_uw_ct_profile_form_alter(&$form, FormStateInter
'wrapper' => $form['#id'],
if ($form['field_uw_ct_profile_contact']['widget'][0]['target_id']) {
// 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'])) {
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