From d15f74698fb4133c13e0195882b654894616fed3 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Tue, 15 Nov 2022 14:55:26 +0100 Subject: [PATCH] chg: [genericElement:index_table] Use provided element for the metafields --- templates/element/genericElements/IndexTable/index_table.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/element/genericElements/IndexTable/index_table.php b/templates/element/genericElements/IndexTable/index_table.php index dc7453c..956fcf8 100644 --- a/templates/element/genericElements/IndexTable/index_table.php +++ b/templates/element/genericElements/IndexTable/index_table.php @@ -25,10 +25,12 @@ if (!empty($requestedMetaFields)) { // Create mapping for new index table fields foreach ($requestedMetaFields as $requestedMetaField) { $template_id = $requestedMetaField['template_id']; $meta_template_field_id = $requestedMetaField['meta_template_field_id']; + $viewElementCandidate = $meta_templates[$template_id]['meta_template_fields'][$meta_template_field_id]['index_type']; + $viewElementCandidatePath = '/genericElements/IndexTable/Fields/' . $viewElementCandidate; $newMetaFields[] = [ 'name' => $meta_templates[$template_id]['meta_template_fields'][$meta_template_field_id]['field'], 'data_path' => "MetaTemplates.{$template_id}.meta_template_fields.{$meta_template_field_id}.metaFields.{n}.value", - 'element' => 'generic_field', + 'element' => $this->elementExists($viewElementCandidatePath) ? $viewElementCandidate : 'generic_field', '_metafield' => true, '_automatic_field' => true, ];