[Import] [ref] Move function to parent for use by siblings
authorEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 26 May 2022 07:21:11 +0000 (19:21 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 26 May 2022 14:19:50 +0000 (02:19 +1200)
CRM/Contact/Import/Form/Preview.php
CRM/Import/Forms.php

index 9f03057aee7e83923545c768ff99c22c7a2851e2..6e34b5657aa45f69ca6311600397d127e59622e1 100644 (file)
@@ -241,26 +241,6 @@ class CRM_Contact_Import_Form_Preview extends CRM_Import_Form_Preview {
     $importJob->isComplete();
   }
 
-  /**
-   * Get the mapped fields as an array of labels.
-   *
-   * e.g
-   * ['First Name', 'Employee Of - First Name', 'Home - Street Address']
-   *
-   * @return array
-   * @throws \API_Exception
-   * @throws \CRM_Core_Exception
-   */
-  protected function getMappedFieldLabels(): array {
-    $mapper = [];
-    $parser = new CRM_Contact_Import_Parser_Contact();
-    $parser->setUserJobID($this->getUserJobID());
-    foreach ($this->getSubmittedValue('mapper') as $columnNumber => $mappedField) {
-      $mapper[$columnNumber] = $parser->getMappedFieldLabel($parser->getMappingFieldFromMapperInput($mappedField, 0, $columnNumber));
-    }
-    return $mapper;
-  }
-
   /**
    * @return \CRM_Contact_Import_Parser_Contact
    */
index 1262fa0e36a8b72a385ee0bb87f2a391784a27af..822fc5d5f1dfb5448f1a7967a8a92d67abb14bfa 100644 (file)
@@ -567,4 +567,24 @@ class CRM_Import_Forms extends CRM_Core_Form {
     return NULL;
   }
 
+  /**
+   * Get the mapped fields as an array of labels.
+   *
+   * e.g
+   * ['First Name', 'Employee Of - First Name', 'Home - Street Address']
+   *
+   * @return array
+   * @throws \API_Exception
+   * @throws \CRM_Core_Exception
+   */
+  protected function getMappedFieldLabels(): array {
+    $mapper = [];
+    $parser = new CRM_Contact_Import_Parser_Contact();
+    $parser->setUserJobID($this->getUserJobID());
+    foreach ($this->getSubmittedValue('mapper') as $columnNumber => $mappedField) {
+      $mapper[$columnNumber] = $parser->getMappedFieldLabel($parser->getMappingFieldFromMapperInput($mappedField, 0, $columnNumber));
+    }
+    return $mapper;
+  }
+
 }