It really is a form layer function, called from one place on the forms
and one on the unit tests
* @throws \API_Exception
*/
protected function getAvailableFields(): array {
- return $this->getParser()->getAvailableFields();
+ $return = [];
+ foreach ($this->getFields() as $name => $field) {
+ if ($name === 'id' && $this->isSkipDuplicates()) {
+ // Duplicates are being skipped so id matching is not available.
+ continue;
+ }
+ $return[$name] = $field['html']['label'] ?? $field['title'];
+ }
+ return $return;
+ }
+
+ /**
+ * Get the fields available for import selection.
+ *
+ * @return array
+ * e.g ['first_name' => 'First Name', 'last_name' => 'Last Name'....
+ *
+ */
+ protected function getFields(): array {
+ return $this->getParser()->getFieldsMetadata();
}
/**
* Once we have cleaned up the way the mapper is handled
* we can ditch all the existing _construct parameters in favour
* of just the userJobID - there are current open PRs towards this end.
+ *
+ * @deprecated
*/
public function getAvailableFields(): array {
$this->setFieldMetadata();
*
* @return array
*/
- protected function getFieldsMetadata() : array {
+ public function getFieldsMetadata() : array {
if (empty($this->importableFieldsMetadata)) {
unset($this->userJob);
$this->setFieldMetadata();