2021-11-05 17:03:11 +01:00
|
|
|
<?php
|
2021-07-06 12:35:50 +02:00
|
|
|
$tabData = [
|
|
|
|
'navs' => [],
|
|
|
|
'content' => []
|
|
|
|
];
|
2021-11-05 17:03:11 +01:00
|
|
|
foreach($data['MetaTemplates'] as $metaTemplate) {
|
2021-07-06 12:35:50 +02:00
|
|
|
if (!empty($metaTemplate->meta_template_fields)) {
|
|
|
|
if ($metaTemplate->is_default) {
|
|
|
|
$tabData['navs'][] = [
|
|
|
|
'html' => $this->element('/genericElements/MetaTemplates/metaTemplateNav', ['metaTemplate' => $metaTemplate])
|
|
|
|
];
|
|
|
|
} else {
|
|
|
|
$tabData['navs'][] = [
|
|
|
|
'text' => $metaTemplate->name
|
|
|
|
];
|
|
|
|
}
|
|
|
|
$fields = [];
|
|
|
|
foreach ($metaTemplate->meta_template_fields as $metaTemplateField) {
|
2021-11-05 17:03:11 +01:00
|
|
|
$labelPrintedOnce = false;
|
|
|
|
foreach ($metaTemplateField->metaFields as $metaField) {
|
|
|
|
$fields[] = [
|
|
|
|
'key' => !$labelPrintedOnce ? $metaField->field : '',
|
|
|
|
'raw' => $metaField->value
|
|
|
|
];
|
|
|
|
$labelPrintedOnce = true;
|
|
|
|
}
|
2021-07-06 12:35:50 +02:00
|
|
|
}
|
|
|
|
$listTable = $this->Bootstrap->listTable([
|
|
|
|
'hover' => false,
|
|
|
|
'elementsRootPath' => '/genericElements/SingleViews/Fields/'
|
|
|
|
],[
|
|
|
|
'item' => false,
|
|
|
|
'fields' => $fields
|
|
|
|
]);
|
|
|
|
$tabData['content'][] = $listTable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!empty($additionalTabs)) {
|
|
|
|
$tabData['navs'] = array_merge($additionalTabs['navs'], $tabData['navs']);
|
|
|
|
$tabData['content'] = array_merge($additionalTabs['content'], $tabData['content']);
|
|
|
|
}
|
|
|
|
if (!empty($tabData['navs'])) {
|
|
|
|
$metaTemplateTabs = $this->Bootstrap->Tabs([
|
|
|
|
'pills' => true,
|
|
|
|
'card' => true,
|
|
|
|
'body-class' => ['p-1'],
|
|
|
|
'data' => $tabData
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
echo $metaTemplateTabs;
|