From 2a23e56c23d7aed183735a9701140ce5639608bc Mon Sep 17 00:00:00 2001 From: John Heckerman <33529618+diabolicdesigns@users.noreply.github.com> Date: Mon, 6 Nov 2023 09:27:00 -0600 Subject: [PATCH] Update main_settings.php Correct the below error by by changing line 98 to "'KEY' to 1 if $arrModuleIDs is empty, and if it's not empty, it will set 'KEY' to the maximum value in the array plus 1." Message: Uncaught ValueError: max(): Argument #1 ($value) must contain at least one element in ...../plugins/dynamictemplate/admin/main_settings.php:98 --- admin/main_settings.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/admin/main_settings.php b/admin/main_settings.php index 98615f2..8d98144 100644 --- a/admin/main_settings.php +++ b/admin/main_settings.php @@ -95,7 +95,8 @@ public function display(){ } $this->tpl->assign_vars(array( - 'KEY' => max($arrModuleIDs)+1, + //'KEY' => max($arrModuleIDs)+1, + 'KEY' => (empty($arrModuleIDs) ? 1 : max($arrModuleIDs) + 1), 'LISTENER' => (new hdropdown('listener', array('options' => $this->user->lang('dynamictemplate_listener'), 'value' => '', 'name' => 'module[KEY][listener]')))->output(), 'EXPORT_DATA' => json_encode($arrExportData, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE), )); @@ -116,4 +117,4 @@ public function display(){ } registry::register('dynamictemplate_main_settings'); -?> \ No newline at end of file +?>