Merge pull request #23231 from civicrm/5.49
[civicrm-core.git] / CRM / Import / Forms.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * This class helps the forms within the import flow access submitted & parsed values.
20 */
21 class CRM_Import_Forms extends CRM_Core_Form {
22
23 /**
24 * Get the submitted value, accessing it from whatever form in the flow it is submitted on.
25 * @param string $fieldName
26 *
27 * @return mixed|null
28 */
29 public function getSubmittedValue(string $fieldName) {
30 $mappedValues = [
31 'skipColumnHeader' => 'DataSource',
32 'fieldSeparator' => 'DataSource',
33 'uploadFile' => 'DataSource',
34 'contactType' => 'DataSource',
35 'dateFormats' => 'DataSource',
36 'savedMapping' => 'DataSource',
37 ];
38 if (array_key_exists($fieldName, $mappedValues)) {
39 return $this->controller->exportValue($mappedValues[$fieldName], $fieldName);
40 }
41 return parent::getSubmittedValue($fieldName);
42
43 }
44
45 }