From c7f1b7cb6e6a055d5574ed0b65b8a1bef0773275 Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Thu, 6 Jun 2024 10:33:19 +0200 Subject: [PATCH] Do not require project IDs for default profile forms --- CRM/Twingle/Form/Profile.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CRM/Twingle/Form/Profile.php b/CRM/Twingle/Form/Profile.php index af1832a..2f7a750 100644 --- a/CRM/Twingle/Form/Profile.php +++ b/CRM/Twingle/Form/Profile.php @@ -571,7 +571,15 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form { // Show warning when there is configuration missing for required fields. $requiredConfig = CRM_Twingle_Profile::allowedAttributes(TRUE); foreach ($requiredConfig as $key => $metadata) { - if (!isset($profile_data[$key]) && $metadata['required']) { + $required = $metadata['required'] ?? FALSE; + // Do not require twingle project IDs/selector for the default profile. + if ( + $this->profile->is_default() + && 'selector' === $key + ) { + $required = FALSE; + } + if (!isset($profile_data[$key]) && $required) { CRM_Core_Session::setStatus( E::ts( 'The required configuration option "%1" has no value. Saving the profile might set this option to a possibly unwanted default value.',