Skip to content
Snippets Groups Projects
Commit 7ba4db06 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #1829328 by Christian Biggins, larowlan | falcon03: Fixed Adding a new...

Issue #1829328 by Christian Biggins, larowlan | falcon03: Fixed Adding a new content type, 'default parent item' is shown even if no menu is selected.
parent 3e3f16e8
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -32,14 +32,19 @@ Drupal.menuUpdateParentList = function () {
var selected = $select.val();
// Remove all exisiting options from dropdown.
$select.children().remove();
// Add new options to dropdown.
// Add new options to dropdown. Keep a count of options for testing later.
var totalOptions = 0;
for (var machineName in options) {
if (options.hasOwnProperty(machineName)) {
$select.append(
$('<option ' + (machineName === selected ? ' selected="selected"' : '') + '></option>').val(machineName).text(options[machineName])
);
totalOptions++;
}
}
// Hide the parent options if there are no options for it.
$select.closest('div').toggle(totalOptions > 0).attr('hidden', totalOptions === 0);
}
});
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment