chg: [genericElement:index_table] Use provided element for the metafields

pull/121/head
Sami Mokaddem 2022-11-15 14:55:26 +01:00
parent 41e425cfa2
commit d15f74698f
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 3 additions and 1 deletions

View File

@ -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,
];