Skip to content

Commit e3789f0

Browse files
committed
Make sure the depends definition works for custom widgets. Also converted code from PrototypeJS to jQuery.
1 parent 32ed03c commit e3789f0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/web/mage/adminhtml/form.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,15 @@ define([
496496
}
497497

498498
// toggle target row
499-
headElement = $(idTo + '-head');
499+
headElement = jQuery('#' + idTo + '-head');
500500
isInheritCheckboxChecked = $(idTo + '_inherit') && $(idTo + '_inherit').checked;
501501
target = $(idTo);
502502

503+
// Account for the chooser style parameters.
504+
if (target === null && headElement.length === 0 && idTo.substring(0, 16) === 'options_fieldset') {
505+
headElement = jQuery('.field-' + idTo).add('.field-chooser' + idTo);
506+
}
507+
503508
// Target won't always exist (for example, if field type is "label")
504509
if (target) {
505510
inputs = target.up(this._config['levels_up']).select('input', 'select', 'td');
@@ -529,10 +534,10 @@ define([
529534
});
530535
}
531536

532-
if (headElement) {
537+
if (headElement.length > 0) {
533538
headElement.show();
534539

535-
if (headElement.hasClassName('open') && target) {
540+
if (headElement.hasClass('open') && target) {
536541
target.show();
537542
} else if (target) {
538543
target.hide();
@@ -567,7 +572,7 @@ define([
567572
});
568573
}
569574

570-
if (headElement) {
575+
if (headElement.length > 0) {
571576
headElement.hide();
572577
}
573578

0 commit comments

Comments
 (0)