From c6c84145d1c503e17423ffa85e7d2c530a907a49 Mon Sep 17 00:00:00 2001
From: Ingolf Steinhardt
Date: Mon, 15 Sep 2025 14:34:43 +0200
Subject: [PATCH] Fix rights check for non-admin user
---
src/Widgets/SubDcaWidget.php | 50 +++++++++++++++++++++++-------------
1 file changed, 32 insertions(+), 18 deletions(-)
diff --git a/src/Widgets/SubDcaWidget.php b/src/Widgets/SubDcaWidget.php
index 12148dcb3..fac21f6ac 100644
--- a/src/Widgets/SubDcaWidget.php
+++ b/src/Widgets/SubDcaWidget.php
@@ -518,11 +518,19 @@ protected function validator($varInput)
}
unset($arrSubField);
+ // Clean all unset keys.
+ foreach (\array_keys($varInput) as $fieldName) {
+ if (!\array_key_exists($fieldName, $this->arrSubFields)) {
+ unset($varInput[$fieldName]);
+ }
+ }
+
if ($blnHasError) {
$this->blnSubmitInput = false;
$this->addError($GLOBALS['TL_LANG']['ERR']['general']);
}
- return $varInput;
+
+ return $varInput ?: null;
}
/**
@@ -606,22 +614,28 @@ public function generate()
. '
';
}
- $strHead = '';
- $strBody = sprintf('%s
', implode("\n", $arrOptions));
-
- $strOutput = sprintf(
- '',
- (($this->style) ? ('style="' . $this->style . '"') : ('')),
- $this->strId,
- $strHead,
- $strBody
- );
-
- return sprintf(
- '%s
',
- $this->strName,
- (strlen($this->strClass) ? ' ' . $this->strClass : ''),
- $strOutput
- );
+ $class = ($this->strClass !== '' ? ' ' . $this->strClass : '');
+ $style = (($this->style) ? ('style="' . $this->style . '"') : (''));
+ $options = implode("
\n", $arrOptions);
+
+ return <<
+
+
+
+ EOF;
}
}