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
3e3f16e8e7
commit
7ba4db06c8
|
@ -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);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue