Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
contextual.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 May 2013 at 17:43 UTC
Updated:
29 Jul 2014 at 22:18 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #1
jessebeach commentedHere's the patch that fixes it. We need to check for Drupal.contextual before accessing Drupal.contextual.collection.
Comment #2
wim leersThere already is a follow-up patch on the issue that introduced this: #1971108-36: Convert contextual.js to use Backbone (and support dynamic contextual links). It solves it very differently though. This is slightly more complex, but also better for front-end perf.
Let's figure out the best solution here.
Comment #3
nod_I'm more for something like #1 than adding the dep to the script.
Comment #4
nod_Same fix as in #1 with a nicer syntax.
Comment #5
nod_If it wasn't for #1639012: Guard against broken behaviors it'd be a critical bug :p
Comment #6
wim leers:)
Comment #7
tim.plunkettI only found it because I run hacked core JS to expose stuff like this.
Comment #8
alexpottNeeds reroll...
Comment #9
nod_turns out #914382: Contextual links incompatible with render cache fixed it so it's all good.
Comment #10
wim leers#9: actually, the solution applied in #914382: Contextual links incompatible with render cache is suboptimal, as you already said in #3. So this patch should still be rerolled, and should remove the dep introduced by #914382: Contextual links incompatible with render cache.
Comment #11
nod_Umm, sure, but in contextual_page_build there is
$page['#attached']['library'][] = array('contextual', 'drupal.contextual-links');Which means that it'll be on the page regardless.
Anyway, here is the patch. Made into an anonymous function otherwise a js checking tool complains about a function defined in a if (because of hoisting and that sort of things).
Comment #12
wim leersYou're right. But it's possible that somebody removes the library in
hook_page_alter()for some reason, and then thanks to #11 we still won't break. So it's still better :)Thanks!
Comment #13
dries commentedCommitted to 8.x. Thanks!
Comment #14
wim leers.