| @@ -120,19 +120,20 @@ | ||
| 120 | 120 | } |
| 121 | 121 | return $attachMentId; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - public function taxonomyData($formFields, $fieldValues) | |
| 124 | + public function getTaxonomies($formFields, $fieldValues) | |
| 125 | 125 | { |
| 126 | - $taxanomyData = []; | |
| 126 | + $taxonomies = []; | |
| 127 | 127 | foreach ($formFields as $fieldKey => $field) { |
| 128 | + $field = 'object' === gettype($field) ? (array) $field : $field; | |
| 128 | 129 | $customType = isset($field['customType']) ? $field['customType'] : null; |
| 129 | - $customType = (!isset($customType) && 'select' === $field->type && isset($field->customTypeList)) ? $field->customTypeList[0] : $customType; | |
| 130 | + $customType = (!isset($customType) && 'select' === $field['type'] && isset($field['customTypeList'])) ? $field['customTypeList'][0] : $customType; | |
| 130 | 131 | if (isset($customType)) { |
| 131 | 132 | if (isset($customType->isTaxonomy) && !empty($fieldValues[$field['key']]) && isset($customType->isHierarchical)) { |
| 132 | 133 | if (true === $customType->isTaxonomy) { |
| 133 | 134 | if (true === $customType->isHierarchical) { |
| 134 | - $taxanomyData[$fieldKey]['value'] = $fieldValues[$field['key']]; | |
| 135 | + $taxonomies[$fieldKey]['value'] = $fieldValues[$field['key']]; | |
| 135 | 136 | } else { |
| 136 | 137 | $slug = ''; |
| 137 | 138 | |
| 138 | 139 | if (is_array($fieldValues[$field['key']])) { |
| @@ -150,14 +151,14 @@ | ||
| 150 | 151 | $slug = $exists->slug; |
| 151 | 152 | } |
| 152 | 153 | } |
| 153 | 154 | |
| 154 | - $taxanomyData[$fieldKey]['value'] = $slug; | |
| 155 | + $taxonomies[$fieldKey]['value'] = $slug; | |
| 155 | 156 | } |
| 156 | - $taxanomyData[$fieldKey]['term'] = $customType->filter->taxanomy; | |
| 157 | + $taxonomies[$fieldKey]['term'] = $customType->filter->taxanomy; | |
| 157 | 158 | } |
| 158 | 159 | } |
| 159 | 160 | } |
| 160 | 161 | } |
| 161 | - return $taxanomyData; | |
| 162 | + return $taxonomies; | |
| 162 | 163 | } |
| 163 | 164 | } |