diff --git a/templates/element/genericElements/SingleViews/single_view.php b/templates/element/genericElements/SingleViews/single_view.php index 4e30d9f..29d1d61 100644 --- a/templates/element/genericElements/SingleViews/single_view.php +++ b/templates/element/genericElements/SingleViews/single_view.php @@ -50,32 +50,36 @@ 'content' => [] ]; foreach($data['metaTemplates'] as $metaTemplate) { - $tabData['navs'][] = $metaTemplate->name; - $fieldsHtml = ''; - foreach ($metaTemplate->meta_template_fields as $metaTemplateField) { - $metaField = $metaTemplateField->meta_fields[0]; - $fieldsHtml .= sprintf( - '', - h($metaField->field), - $this->element( - '/genericElements/SingleViews/Fields/genericField', - [ - 'data' => $metaField->value, - 'field' => [ - 'raw' => $metaField->value + if (!empty($metaTemplate->meta_template_fields)) { + $tabData['navs'][] = $metaTemplate->name; + $fieldsHtml = '
%s%s
'; + foreach ($metaTemplate->meta_template_fields as $metaTemplateField) { + $metaField = $metaTemplateField->meta_fields[0]; + $fieldsHtml .= sprintf( + '', + h($metaField->field), + $this->element( + '/genericElements/SingleViews/Fields/genericField', + [ + 'data' => $metaField->value, + 'field' => [ + 'raw' => $metaField->value + ] ] - ] - ) - ); + ) + ); + } + $fieldsHtml .= '
%s%s
'; + $tabData['content'][] = $fieldsHtml; } - $fieldsHtml .= ''; - $tabData['content'][] = $fieldsHtml; } - $metaTemplateTabs = $this->Bootstrap->Tabs([ - 'pills' => true, - 'card' => true, - 'data' => $tabData - ]); + if (!empty($tabData['navs'])) { + $metaTemplateTabs = $this->Bootstrap->Tabs([ + 'pills' => true, + 'card' => true, + 'data' => $tabData + ]); + } } $ajaxLists = ''; if (!empty($children)) {