From: Eileen McNaughton Date: Mon, 15 Aug 2022 22:36:56 +0000 (+1200) Subject: Remove last usage of _fields X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ff83ed982355101360e7c77ad509ce32b9a40d2b;p=civicrm-core.git Remove last usage of _fields --- diff --git a/CRM/Import/Parser.php b/CRM/Import/Parser.php index f862d8715b..07134ad07a 100644 --- a/CRM/Import/Parser.php +++ b/CRM/Import/Parser.php @@ -496,11 +496,9 @@ abstract class CRM_Import_Parser implements UserJobInterface { public function getSelectTypes() { $values = []; // This is only called from the MapField form in isolation now, - // so we need to set the metadata. - $this->init(); - foreach ($this->_fields as $name => $field) { - if (isset($field->_hasLocationType)) { - $values[$name] = $field->_hasLocationType; + foreach ($this->getFieldsMetadata() as $name => $field) { + if (isset($field['hasLocationType'])) { + $values[$name] = TRUE; } } return $values; @@ -1801,6 +1799,19 @@ abstract class CRM_Import_Parser implements UserJobInterface { $this->setFieldMetadata(); } + /** + * Get metadata for all importable fields. + * + * @return array + */ + protected function getFieldsMetadata() : array { + if (empty($this->importableFieldsMetadata)) { + unset($this->userJob); + $this->setFieldMetadata(); + } + return $this->importableFieldsMetadata; + } + /** * @param array $mappedField * Field detail as would be saved in field_mapping table