Skip to content

Commit

Permalink
fix(dropdownfield): handle specific case with Entity itemtype
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Jun 23, 2023
1 parent 144fc49 commit bd25e7d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions inc/field/dropdownfield.class.php
Expand Up @@ -304,14 +304,15 @@ public function buildParams($rand = null) {
// Set specific root if defined (CommonTreeDropdown)
$baseLevel = 0;
if (isset($decodedValues['show_tree_root'])
&& (int) $decodedValues['show_tree_root'] > 0
&& ((int) $decodedValues['show_tree_root'] > 0
|| $itemtype == Entity::class && (int) $decodedValues['show_tree_root'] > -1)
) {
$sons = (new DBUtils)->getSonsOf(
$itemtype::getTable(),
$decodedValues['show_tree_root']
);
$decodedValues['selectable_tree_root'] = $decodedValues['selectable_tree_root'] ?? '1';
if (!isset($decodedValues['selectable_tree_root']) || $decodedValues['selectable_tree_root'] == '0') {
if ($decodedValues['selectable_tree_root'] == '0') {
unset($sons[$decodedValues['show_tree_root']]);
}

Expand Down

0 comments on commit bd25e7d

Please sign in to comment.