Quick Edit menu item is not shown. Instead, I get:
Uncaught TypeError: Cannot call method 'getAttribute' of undefined at: .getAttribute('data-edit-entity-instance-id');
The status report page is all green.
Quick Edit menu item is not shown. Instead, I get:
Uncaught TypeError: Cannot call method 'getAttribute' of undefined at: .getAttribute('data-edit-entity-instance-id');
The status report page is all green.
Comments
Comment #1
wim leersI've already explained in #2154891-8: Quick Edit contextual link not shown.2 why this happens:
So, please clarify.
Comment #2
yannisc commentedIt also happens on sites with no Display Suite installed.
Comment #3
yannisc commentedI don't know if there are other implications with this, but the following patch made Quick Edit to work:
--- /sites/all/modules/edit/js/edit.js
+++ (clipboard)
@@ -208,9 +208,11 @@
if (entityElement.length === 0) {
entityElement = $('.region-content').find(entityElementSelector);
}
- var entityInstanceID = entityElement
- .get(0)
- .getAttribute('data-edit-entity-instance-id');
+ if(typeof entityElement.get(0) != 'undefined'){
+ var entityInstanceID = entityElement
+ .get(0)
+ .getAttribute('data-edit-entity-instance-id');
+ }
// Early-return if metadata for this field is missing.
if (!metadata.has(fieldID)) {
Comment #4
loopduplicate commentedThis happened to me because of a conflict with Zen.
Zen doesn't include the wrapper in its region template and the $classes string isn't rendered. ( https://drupal.org/node/1728134 ) Included in the $classes string is the class 'region-content'. The missing class seems to be causing the js error. See line 209 of edit.js:
since an element with the class doesn't exist, there is no method getAttribute as expected on line 213.
Comment #5
loopduplicate commentedHere's what I did to fix the error:
Cheers,
Jeff
Comment #6
wim leers#2: I replied to your e-mail; the testing instructions you provided me longer work.
#4, #5: Thanks, that was tremendously useful! I've written an automated (though best-effort) status report requirement that checks whether the theme removes the "region-content" class, either by explicitly removing that class, or by removing the region wrapper altogether. I've also documented how to fix it in the README, pointing to your comments here.
That should help users in the future :)
I've done that at #2167981: Do a best-effort theme compatibility check in the status report.
Comment #7
wim leersSo, #4/#5 have been addressed.
That leaves just #2. #2 has been answered in e-mail — yannisc had two problems:
So, with that, this support request has been answered!