Use internal variable rather than property to pass variable
authorEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 15 Jul 2023 01:11:05 +0000 (13:11 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Sat, 15 Jul 2023 01:11:05 +0000 (13:11 +1200)
CRM/Contact/Form/Edit/CustomData.php

index 61bb1c36348e0fa6c03f7415c50001a33f03d8be..4e4830145363d03ced9918da65fccf5d64850a44 100644 (file)
@@ -24,20 +24,20 @@ class CRM_Contact_Form_Edit_CustomData {
    * Build all the data structures needed to build the form.
    *
    * @param CRM_Core_Form $form
+   *
+   * @throws \CRM_Core_Exception
    */
   public static function preProcess(&$form) {
-    $form->_type = CRM_Utils_Request::retrieve('type', 'String');
+    $customDataType = CRM_Utils_Request::retrieve('type', 'String');
 
-    //build the custom data as other blocks.
-    //$form->assign( "addBlock", false );
-    if ($form->_type) {
+    if ($customDataType) {
       $form->_addBlockName = 'CustomData';
       $form->assign("addBlock", TRUE);
       $form->assign("blockName", $form->_addBlockName);
     }
 
     CRM_Custom_Form_CustomData::preProcess($form, NULL, NULL, NULL,
-      ($form->_type) ? $form->_type : $form->_contactType
+      $customDataType ?: $form->_contactType
     );
 
     //assign group tree after build.