Move no-longer-shared function back to it's form
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 30 Aug 2023 20:51:29 +0000 (08:51 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 30 Aug 2023 21:44:44 +0000 (09:44 +1200)
CRM/Contact/Form/Contact.php
CRM/Contact/Form/Location.php

index e839389812dd42f9375e2d1ddeaa1d756334021b..856877a178c6bbe0ae8aa63421289bece99f7c69 100644 (file)
@@ -312,8 +312,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     // also keep the convention.
     $this->assign('contactId', $this->_contactId);
 
-    // location blocks.
-    CRM_Contact_Form_Location::preProcess($this);
+    $this->preProcessLocation();
 
     // retain the multiple count custom fields value
     if (!empty($_POST['hidden_custom'])) {
@@ -375,6 +374,29 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     $this->assign('paramSubType', $paramSubType ?? '');
   }
 
+  private function preProcessLocation() {
+    $this->_addBlockName = CRM_Utils_Request::retrieve('block', 'String');
+    $additionalblockCount = CRM_Utils_Request::retrieve('count', 'Positive');
+
+    $this->assign('addBlock', FALSE);
+    if ($this->_addBlockName && $additionalblockCount) {
+      $this->assign('addBlock', TRUE);
+      $this->assign('blockName', $this->_addBlockName);
+      $this->assign('blockId', $additionalblockCount);
+      $this->set($this->_addBlockName . '_Block_Count', $additionalblockCount);
+    }
+
+    $this->assign('blocks', $this->_blocks);
+    $this->assign('className', 'CRM_Contact_Form_Contact');
+
+    // get address sequence.
+    if (!$addressSequence = $this->get('addressSequence')) {
+      $addressSequence = CRM_Core_BAO_Address::addressSequence();
+      $this->set('addressSequence', $addressSequence);
+    }
+    $this->assign('addressSequence', $addressSequence);
+  }
+
   /**
    * Set default values for the form.
    *
index 0a70e880209907f94f4dd2258e3ba3475982e6cf..8040a045f503d530cc4f52abe90f76803836dc85 100644 (file)
  */
 class CRM_Contact_Form_Location {
 
-  /**
-   * Set variables up before form is built.
-   *
-   * @param CRM_Core_Form $form
-   */
-  public static function preProcess($form) {
-    $form->_addBlockName = CRM_Utils_Request::retrieve('block', 'String');
-    $additionalblockCount = CRM_Utils_Request::retrieve('count', 'Positive');
-
-    $form->assign('addBlock', FALSE);
-    if ($form->_addBlockName && $additionalblockCount) {
-      $form->assign('addBlock', TRUE);
-      $form->assign('blockName', $form->_addBlockName);
-      $form->assign('blockId', $additionalblockCount);
-      $form->set($form->_addBlockName . '_Block_Count', $additionalblockCount);
-    }
-
-    $form->assign('blocks', $form->_blocks);
-    $form->assign('className', CRM_Utils_System::getClassName($form));
-
-    // get address sequence.
-    if (!$addressSequence = $form->get('addressSequence')) {
-      $addressSequence = CRM_Core_BAO_Address::addressSequence();
-      $form->set('addressSequence', $addressSequence);
-    }
-    $form->assign('addressSequence', $addressSequence);
-  }
-
   /**
    * Build the form object.
    *