From e7ed302ea03f3fdf73b8b1bfd319d7ec6a24592b Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 26 Sep 2024 18:36:50 +0200 Subject: [PATCH] Allow text "all_no_acl" for globalCategories --- api/src/Etemplate/Widget/Select.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/api/src/Etemplate/Widget/Select.php b/api/src/Etemplate/Widget/Select.php index 511db31abd..a57be3fe4d 100644 --- a/api/src/Etemplate/Widget/Select.php +++ b/api/src/Etemplate/Widget/Select.php @@ -763,8 +763,19 @@ class Select extends Etemplate\Widget { $categories = new Api\Categories($type5, $application); } - // Allow text for global - $globalCategories = $globalCategories && (strlen($globalCategories) > 1 ? $globalCategories === 'true' : (bool)$globalCategories); + // Allow text "all_no_acl" for globalCategories + switch($globalCategories) + { + case 'all_no_acl': + break; + case 'true': + case 'false': + $globalCategories = $globalCategories === 'true'; + break; + default: + $globalCategories = (bool)$globalCategories; + break; + } // we cast $type4 (parent) to int, to get default of 0 if omitted $cats = $categories->return_sorted_array(0, False, '', '', '', $globalCategories, (int)$parentCat, true) ?: []; $cat2option = static function(array $cat) use (&$cat2option, $globalCategories, $cats)