Skip to content

Commit

Permalink
fix: remove multiple dropdown option for documents (#844)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rom1-B authored Oct 9, 2024
1 parent 57efab0 commit 507a7b1
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions ajax/field_specific_fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ function ($itemtype) {
}
echo '</td>';
} else {
$dropdown_matches = [];
$is_dropdown = $type == 'dropdown' || preg_match('/^dropdown-(?<class>.+)$/', $type, $dropdown_matches) === 1;
$dropdown_matches = [];
$is_dropdown = $type == 'dropdown' || preg_match('/^dropdown-(?<class>.+)$/', $type, $dropdown_matches) === 1;
$is_dropdown_multi = ($is_dropdown && ($type != 'dropdown-Document'));

// Display "default value(s)" field
echo '<td>';
if ($is_dropdown) {
if ($is_dropdown_multi) {
echo __('Multiple dropdown', 'fields') . ' :';
echo '<br />';
}
Expand All @@ -94,21 +95,25 @@ function ($itemtype) {

echo '<td>';
if ($is_dropdown) {
$multiple = (bool) ($_POST['multiple'] ?? $field->fields['multiple']);
if ($is_dropdown_multi) {
$multiple = (bool) ($_POST['multiple'] ?? $field->fields['multiple']);

if ($field->isNewItem()) {
Dropdown::showYesNo(
'multiple',
$multiple,
-1,
[
'rand' => $rand,
],
);
if ($field->isNewItem()) {
Dropdown::showYesNo(
'multiple',
$multiple,
-1,
[
'rand' => $rand,
],
);
} else {
echo Dropdown::getYesNo($multiple);
}
echo '<br />';
} else {
echo Dropdown::getYesNo($multiple);
$multiple = false;
}
echo '<br />';

echo '<div style="line-height:var(--tblr-body-line-height);">';
if ($field->isNewItem() && $type == 'dropdown') {
Expand Down

0 comments on commit 507a7b1

Please sign in to comment.