0

When I try to upload an image through anything other than the admin/content/media interface, I get an "Drupal.media is undefined" error.

Uploading an image through the interface does work. Using the Firefox developer console I can search all files (!drupal.media). It finds something on admin/content/media but nothing on other pages.

I do have the Media module installed, and I am aware of the following modules being affected: md_slider and stability (a theme).

Why does this happen, and how can I fix it?

Console log on Chrome

'Attr.nodeValue' is deprecated. Please use 'value' instead.
Resource interpreted as Image but transferred with MIME type text/html: "http://xxx/admin/structure/md-slider/4/undefined".
Uncaught TypeError: Cannot read property 'popups' of undefined

Console log on FireFox

SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
Error: http://xxx/sites/default/files/js/js_oCVMDTeSNt-_QxknevWyf6yO5OzmME3AhRz3ggZgNtg.js is being assigned a //# sourceMappingURL, but already has one
Use of getPreventDefault() is deprecated.  Use defaultPrevented instead.
Use of getAttributeNode() is deprecated. Use getAttribute() instead.
Use of attributes' nodeValue attribute is deprecated. Use value instead.
Use of attributes' specified attribute is deprecated. It always returns true.
Use of getPreventDefault() is deprecated.  Use defaultPrevented instead.
TypeError: Drupal.media is undefined

List of installed modules

Chaos tool suite Chaos tools (ctools) Module Enabled 7.x-1.5

Core Block (block) Module Enabled 7.34

Core Color (color) Module Enabled 7.34

Core Contextual links (contextual) Module Enabled 7.34

Core Dashboard (dashboard) Module Enabled 7.34

Core Database logging (dblog) Module Enabled 7.34

Core Field (field) Module Enabled 7.34

Core Field SQL storage (field_sql_storage) Module Enabled 7.34

Core Field UI (field_ui) Module Enabled 7.34

Core File (file) Module Enabled 7.34

Core Filter (filter) Module Enabled 7.34

Core Help (help) Module Enabled 7.34

Core Image (image) Module Enabled 7.34

Core List (list) Module Enabled 7.34

Core Menu (menu) Module Enabled 7.34

Core Node (node) Module Enabled 7.34

Core Number (number) Module Enabled 7.34

Core Options (options) Module Enabled 7.34

Core Overlay (overlay) Module Enabled 7.34

Core Path (path) Module Enabled 7.34

Core RDF (rdf) Module Enabled 7.34

Core Search (search) Module Enabled 7.34

Core Shortcut (shortcut) Module Enabled 7.34

Core Statistics (statistics) Module Enabled 7.34

Core System (system) Module Enabled 7.34

Core Taxonomy (taxonomy) Module Enabled 7.34

Core Text (text) Module Enabled 7.34

Core Toolbar (toolbar) Module Enabled 7.34

Core Update manager (update) Module Enabled 7.34

Core User (user) Module Enabled 7.34

Fields Link (link) Module Enabled 7.x-1.3

Mail SMTP Authentication Support (smtp) Module Enabled 7.x-1.0

Media File entity (file_entity) Module Enabled 7.x-1.4

Media IMCE (imce) Module Enabled 7.x-1.9

Media Media (media) Module Enabled 7.x-1.4

Media Media Internet Sources (media_internet) Module Enabled 7.x-1.4

MegaDrupal MD Slider (md_slider) Module Enabled 7.x-2.15

NikaDevs NikaDevs Main Features (nikadevs_cms) Module Enabled 7.x-1.0

NikaDevs NikaDevs Visual Shortcodes (nd_visualshortcodes) Module Enabled 7.x-1.0

NikaDevs Stability Shortcodes (stability_shortcodes) Module Enabled 7.x - 1.2

NikaDevs Stability theme module (stability_cms) Module Enabled 7.x - 1.2

Other Token (token) Module Enabled 7.x-1.5

Shortcode Shortcode (shortcode) Module Enabled 7.x-2.1

User interface CKEditor (ckeditor) Module Enabled 7.x-1.16

User interface jQuery Update (jquery_update) Module Enabled 7.x-2.4

Views Views (views) Module Enabled 7.x-3.8

Views Views Load More (views_load_more) Module Enabled 7.x-1.5

Views Views UI (views_ui) Module Enabled 7.x-3.8

Core Seven (seven) Theme Enabled 7.34

Other Stability (stability) Theme Enabled 7.x-1.4.2

  • Can you please provide a list of the modules using as also the console log when the error appears? Also, since the theme you are using is not free this might be a problem with testing. – TheodorosPloumis Jan 8 '15 at 10:56
  • @TheodorosPloumis please see the updated question. I am afraid it will be more difficult. I have already contacted the creators of MD Slider though I have not got any response whatsoever. – AmazingDreams Jan 8 '15 at 12:50
  • Could you disable javascript-aggregation, so we can see which js-file causes the trouble? – Nebel54 Jan 14 '15 at 16:32
  • Yes, error is on: md-slider-panel.js?nhuw2e:7 I already contacted the maintainer of md-slider though I have not heard anything from them. – AmazingDreams Jan 15 '15 at 10:09
1

I am afraid this error comes from the jQuery version.

Since you have the jQuery_update module check if the admin has the same version with the frontend. If not change the jQuery version of the admin to be the same as the frontend's (this can be through the modules UI page). Then, check if the same error occurs on the admin page. If so you have to test the frontend with other jQuery versions.

Notice that in case you cannot use the proper jQuery version for the frontend (since there are confilcts with other modules) then the only solution is to disable these modules or override them.

Before that, maybe you could use the latest dev versions for media, jquery_update modules and check if the problem remains.

  • Thanks. I have already tested with some (not all) versions of jQuery through the module config page, I'll test different combinations and let you know. – AmazingDreams Jan 8 '15 at 14:15
  • I tried the different combinations though it did not help. I'll try the dev versions after I've annoyed the maintainers of md-slider some more – AmazingDreams Jan 15 '15 at 10:11
  • @AmazingDreams If uninstalling the md_slider module solves the problem then, yes, this problem causes the problem. – TheodorosPloumis Jan 15 '15 at 14:57
0

I contacted the dev of the stability theme. He gave me a link to update the md_slider module to v7.16.

This fixed the issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.