With the latest stable and dev versions of Panels v3.4 and Page manager installed, I receive a javascript error "Cannot set property 'Layout' of undefined" when adding a page. On a clean install using simplytest.me/project/panels at admin/structure/pages/add I add a page by only inputting a title and path, on the next page the error appears.

It seems panels/js/layout.js cannot declare Drupal.Panels.Layout since Drupal.Panels has not been defined. This is because panels/js/panels-base.js has not been loaded in panels/includes/display-layout.inc.

At line 97 panels/js/layout.js is loaded, we can load panels-base.js by inserting

ctools_add_js('panels-base', 'panels');

or

$renderer = panels_get_renderer_handler('editor', $display);
$renderer->add_meta();

at the line before. (sorry I cannot make a patch)

Thanks for the great work, loving Panels big time!

Comments

morenstrat’s picture

I have the same problem with panel nodes, but only when JS aggregation is turned on. I get this error on "node/[nid]/panel_layout" pages:

Error in layout.js on line 8:

TypeError: Drupal.Panels is undefined
Drupal.Panels.Layout = {};

With JS aggregation off, the error is gone.

irodriguez’s picture

I am experiencing the same issue as comment #1. When I turn on JS aggregation I get the same error

TypeError: Drupal.Panels is undefined
Drupal.Panels.Layout = {};

in layout.js. When I turn JS aggregation off then the problem is not as prominent although the error remains.

I am using Drupal 7.26, and Panels 7.x-3.4

I noticed that panels-base.js is not being loaded before layout.jsin my , should this be loading? It seems to contain the master variable/object instance Drupal.Panels.

irodriguez’s picture

I have attached a patch for this issue that will include panels-base.js within includes/display-layouts.inc adjust urls in the patch as needed. as of now the patch is applied to /sites/all/modules/panels

sylus’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new369 bytes

Ran into this same problem. I rerolled into a proper patch for drush make purposes.

Patch works as mentioned in earlier post and seems reasonable so RTBC.

hanoii’s picture

works!

socialnicheguru’s picture

worked for me too

proteo’s picture

@sylus, #4 worked for me too, thanks!

anybody’s picture

Works for me and should be patched ASAP! Sadly this thread is already 5 month old :(

csc4’s picture

This just for me.. patch seems to work

drurian’s picture

Please, commit, it's just one line.

mkhamash’s picture

RTBC+

japerry’s picture

Status: Reviewed & tested by the community » Fixed

heh I've ran into this issue too. Works now, Fixed!

  • japerry committed 55f5972 on 7.x-3.x authored by sylus
    Issue #2199391 by irodriguez, sylus: Javascript error "Cannot set...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.