From 314d3829a213b97091d08a8f32ba14749d29f454 Mon Sep 17 00:00:00 2001 From: suvikankare Date: Thu, 15 Feb 2024 12:24:14 +0200 Subject: [PATCH] fix: AU-2143: add phone number to private person applicantinfo (#1188) * AU-2143: add phone number to private person applicantinfo * AU-2143: edit suffix * AU-2143: edit suffix --------- Co-authored-by: Suvi Kankare --- .../src/Element/ApplicantInfoComposite.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/public/modules/custom/grants_applicant_info/src/Element/ApplicantInfoComposite.php b/public/modules/custom/grants_applicant_info/src/Element/ApplicantInfoComposite.php index 358547de58..32ed714eae 100644 --- a/public/modules/custom/grants_applicant_info/src/Element/ApplicantInfoComposite.php +++ b/public/modules/custom/grants_applicant_info/src/Element/ApplicantInfoComposite.php @@ -120,6 +120,8 @@ protected static function getPrivatePersonFormElements(AtvDocument $grantsProfil $helsinkiProfiiliDataService = \Drupal::service('helfi_helsinki_profiili.userdata'); $userData = $helsinkiProfiiliDataService->getUserProfileData(); + $suffix = array_key_exists('phone_number', $profileContent) ? '' : ''; + $elements['firstname'] = [ '#type' => 'textfield', '#title' => t('First name'), @@ -201,8 +203,21 @@ protected static function getPrivatePersonFormElements(AtvDocument $grantsProfil '#wrapper_attributes' => [ 'class' => ['grants-handler--prefilled-field'], ], - '#suffix' => '', + '#suffix' => $suffix, ]; + if (array_key_exists('phone_number', $profileContent)) { + $elements['phone_number'] = [ + '#type' => 'textfield', + '#title' => t('Phone number'), + '#readonly' => TRUE, + '#required' => TRUE, + '#value' => $profileContent["phone_number"], + '#wrapper_attributes' => [ + 'class' => ['grants-handler--prefilled-field'], + ], + '#suffix' => '', + ]; + } return $elements; }