3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class helps the forms within the import flow access submitted & parsed values.
21 class CRM_Import_Forms
extends CRM_Core_Form
{
24 * Get the submitted value, accessing it from whatever form in the flow it is submitted on.
25 * @param string $fieldName
29 public function getSubmittedValue(string $fieldName) {
31 'skipColumnHeader' => 'DataSource',
32 'fieldSeparator' => 'DataSource',
33 'uploadFile' => 'DataSource',
34 'contactType' => 'DataSource',
35 'dateFormats' => 'DataSource',
36 'savedMapping' => 'DataSource',
38 if (array_key_exists($fieldName, $mappedValues)) {
39 return $this->controller
->exportValue($mappedValues[$fieldName], $fieldName);
41 return parent
::getSubmittedValue($fieldName);
46 * Get the available datasource.
48 * Permission dependent, this will look like
50 * 'CRM_Import_DataSource_CSV' => 'Comma-Separated Values (CSV)',
51 * 'CRM_Import_DataSource_SQL' => 'SQL Query',
54 * The label is translated.
58 protected function getDataSources(): array {
60 foreach (['CRM_Import_DataSource_SQL', 'CRM_Import_DataSource_CSV'] as $dataSourceClass) {
61 $object = new $dataSourceClass();
62 if ($object->checkPermission()) {
63 $dataSources[$dataSourceClass] = $object->getInfo()['title'];