Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When there's no admin menu toolbar the ultimenu throws an exception
Uncaught DrupalBehaviorError: attach ; ultimenu: t(...).find(...).once is not a functionDrupal.attachBehaviors @ js_TPAFFvtTJS4h7hFTiH-_scRePSQ22xtWEPlO7KuMt6U.js:222(anonymous function) @ js_TPAFFvtTJS4h7hFTiH-_scRePSQ22xtWEPlO7KuMt6U.js:227n.addEventListener.t @ js_TPAFFvtTJS4h7hFTiH-_scRePSQ22xtWEPlO7KuMt6U.js:4
The user is not able to expand the hamburger menu.
Exception thrown on this function:
Drupal.attachBehaviors = function (context, settings) {
context = context || document;
settings = settings || drupalSettings;
var errors = [];
var behaviors = Drupal.behaviors;
// Execute all of them.
for (var i in behaviors) {
if (behaviors.hasOwnProperty(i) && typeof behaviors[i].attach === 'function') {
// Don't stop the execution of behaviors in case of an error.
try {
behaviors[i].attach(context, settings);
}
catch (e) {
errors.push({behavior: i, error: e});
}
}
}
// Once all behaviors have been processed, inform the user about errors.
if (errors.length) {
throw new DrupalBehaviorError(errors, 'attach');
}
};
Comments
Comment #2
gausarts CreditAttribution: gausarts commentedThanks for the report.
Could you provide more info what Drupal version you are using? And what profile, Standard or Minimal?
The module was tested against beta14 and the latest Dev I picked up last week and I have no such issue so far. Not sure yet about the latest one since last week onward.
I also uninstalled contrib admin_toolbar and core toolbar, and haven't been able to re-produce it yet since maybe I used the Standard profile, not Minimal one.
Most likely it is a dependency issue.
If that is the case, could you please open ultimenu.libraries.yml, add extra lines as shown below after # Add explicit dependency line:
Be sure to clear cache admin/config/development/performance, and maybe regenerate JS for just in case.
Please let me know if that solves it, so we can add it there.
Comment #3
jclopez CreditAttribution: jclopez commentedRight now I'm on drupal 8.0.0-beta14 with a standard profile, I tried with ultimenu version 8.x-1.0 and also with the DEV version and both were not working.
I added the extra dependencies on ultimenu.libraries.yml and cleared cache, now the hamburger menu is working when there isn't an Admin toolbar menu, this is on the ultimenu DEV version.
Thank you
Comment #4
gausarts CreditAttribution: gausarts commentedOk, thanks for the update. Will add the fix once I get a chance to get back to it.
Comment #5
gausarts CreditAttribution: gausarts commentedComment #7
gausarts CreditAttribution: gausarts commentedPushed to Dev. Thanks a lot.