From ad8ce73fdf48add7dfef76a3d0b81e69c0cf6d93 Mon Sep 17 00:00:00 2001 From: mokaddem Date: Mon, 7 Dec 2020 16:20:20 +0100 Subject: [PATCH] fix: [genericElements:form] Make sure current model have meta-templates --- .../element/genericElements/Form/genericForm.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/templates/element/genericElements/Form/genericForm.php b/templates/element/genericElements/Form/genericForm.php index 864aca7..75aedd1 100644 --- a/templates/element/genericElements/Form/genericForm.php +++ b/templates/element/genericElements/Form/genericForm.php @@ -62,12 +62,14 @@ ); } } - $metaTemplateString = $this->element( - 'genericElements/Form/metaTemplateScaffold', [ - 'metaTemplatesData' => $data['metaTemplates'], - 'form' => $this->Form, - ] - ); + if (!empty($data['metaTemplates']) && $data['metaTemplates']->count() > 0) { + $metaTemplateString = $this->element( + 'genericElements/Form/metaTemplateScaffold', [ + 'metaTemplatesData' => $data['metaTemplates'], + 'form' => $this->Form, + ] + ); + } $submitButtonData = ['model' => $modelForForm, 'formRandomValue' => $formRandomValue]; if (!empty($data['submit'])) { $submitButtonData = array_merge($submitButtonData, $data['submit']);