I was getting Drupal.ajax is undefined on every page so I wrapped the ajax commands in a check to see whether Drupal.ajax is defined. This really needs testing as its just a quick fix for a problem that was annoying me but I haven't fully tested the repercussions.

Comments

tanc’s picture

Status: Active » Needs review
StatusFileSize
new6.21 KB

Patch attached. Also some minor style cleanup.

tanc’s picture

I've tracked down the issue to Admin module breaking Drupal.ajax. I think my patch can probably be ignored.

tirdadc’s picture

Status: Needs review » Closed (works as designed)

Alright, closing this since it's not tied to boxes specifically.

open social’s picture

Project: Boxes » Administration menu
Version: 7.x-1.x-dev » 7.x-3.x-dev

Okay.. but this is an administration menu issue,.
I searched the issue queue but could not find anything.

The problem for me is like this:

Admin_menu enabled. Boxes and views enabled.
Loading the pages gives a drupal.ajax not found error.

boxes breaks at: Drupal.ajax.prototype.commands['getBlock'] = function(ajax, response, status) {

views breaks at: Error: Drupal.ajax is undefined
Source File: http://edv.local/sites/all/modules/contrib/views/js/ajax_view.js?m2xfuj
Line: 118

With no admin_menu it works fine.

open social’s picture

Found a fix for this.. it seems it is more a drupal issue or module specific.

/**
 * Implements hook_js_alter()
 */
functionYOURMODULENAME_js_alter(&$javascript) {
	$javascript['misc/ajax.js']['weight'] = -10;
}

When using something like this the misc js is loaded before the boxes/admin_menu module. Then things seem to be fine

farald’s picture

The fix in #5 also works where other modules are causing the error, in my case Views Quicksand.