From b674d361ca0d14aa425f10e8e7364affe86eb108 Mon Sep 17 00:00:00 2001 From: Kamil Kuzminski Date: Fri, 11 May 2018 09:45:15 +0200 Subject: [PATCH] Fixed #92 error if the config could not be loaded (#94) --- src/CustomElements.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/CustomElements.php b/src/CustomElements.php index 733ddd7..63a2f05 100644 --- a/src/CustomElements.php +++ b/src/CustomElements.php @@ -444,6 +444,12 @@ protected function prepareSaveData($fieldPrefix, $fieldsConfig) */ protected function createDca($dc, $type, $createFromPost = false, $tmpField = null) { + $config = static::getConfigByType($type); + + if (!$config) { + return; + } + $assetsDir = 'bundles/rocksolidcustomelements'; if (TL_MODE === 'BE') { @@ -452,8 +458,6 @@ protected function createDca($dc, $type, $createFromPost = false, $tmpField = nu } $paletteFields = array(); - - $config = static::getConfigByType($type); $standardFields = is_array($config['standardFields']) ? $config['standardFields'] : array(); $this->fieldsConfig = $config['fields']; @@ -858,8 +862,12 @@ protected function createDcaMultiEdit($dc) foreach ($types as $type) { $paletteFields = array(); - $config = static::getConfigByType($type); + + if (!$config) { + continue; + } + $standardFields = is_array($config['standardFields']) ? $config['standardFields'] : array(); foreach ($config['fields'] as $fieldName => $fieldConfig) {