Closed (fixed)
Project:
D7 Media
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 Nov 2010 at 21:08 UTC
Updated:
9 Feb 2011 at 17:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
Scott J commentedI can confirm this error.
It only happens when inserting media inline with wysiwyg button. I have no error when browsing a multimedia asset field.
Comment #2
michaelschutz commentedAdditional confirmation. I get the message after uploading (though the file uploads ok - it'll appear in my Library) and when trying to insert media inline using the WYSIYG button. The screen darkens and becomes unusable, and I need to hit the back button to get out.
Sorry I can't help troubleshoot code, can only report.
Using...
Drupal core 7.0-beta3 (just uploaded it tonight)
Media 7.x-1.0-beta1
Styles 7.x-1.0-alpha4
Entity 7.x-1.0-beta1
Comment #3
JacobSingh commentedSee the top of the project page on media releases (see "READ THIS").
Thanks for the report though, please confirm w/ BETA2
Comment #4
bjalford commentedI know you need someone to test against D7-beta2, but since I've just done some testing and written it up I thought it'd be useful to post it:
1) D7 beta 3 with:
- Styles 1-dev
- media beta2
- media gallery beta1
- wysiwyg 2-dev
- multiform 1-dev
- entity beta 2
- TinyMCE
Steps:
1) Enable Styles and file styles - no issues
2) Enable Entity Metadata, Entity CRUD API and Multiple forms - no issues
3) Enable wysiwyg - no issues
4) Enable Media - no issues
5) Configuration wysiwyg profiles
6) Enable TinyMCE for full html
7) Edit -> Buttons -> Media browser
8) Add content -> Basic page
9) click media browser
10) Upload a file - results in screen going gray and freezing
Comment #5
bjalford commentedRefreshing the browser returns these messages:
* Notice: Undefined index: media_link in media_format_form() (line 262 of /var/aegir/media8/sites/all/modules/media/media.filter.inc).
* Notice: Undefined index: media_link in media_get_file_without_label() (line 355 of /var/aegir/media8/sites/all/modules/media/media.filter.inc).
* Notice: Undefined index: settings in media_get_file_without_label() (line 357 of /var/aegir/media8/sites/all/modules/media/media.filter.inc).
* Warning: array_merge(): Argument #1 is not an array in media_get_file_without_label() (line 357 of /var/aegir/media8/sites/all/modules/media/media.filter.inc).
Comment #6
JacobSingh commented@bjalford:
This is awesome. Thank you so much for the thorough steps to reproduce.
Since BETA2 has been cut, anyone who wants to start on stabilizing HEAD for BETA3 is my hero.
Best,
Jacob
Comment #7
Wuk commentedI have similar fresh installation (I use CKEditor).
To Basic page I have added "Multimedia asset" -> "Media file selector" filed.
If I try to use Media browser through wysiwyg and CKEditor I get exactly same error.
If I try to use Media browser through added field everything is OK, but then images are added as attachments not as part of a text.
It seems to me that problem arises when Media browser is trying to insert image into the body.
Comment #8
JacobSingh commentedNo need to +1 this. BETA-3 is not supported yet. If you want to start trying to fix it or you have additional info to share, go for it.
Comment #9
mcaden commentedI'm still geting a feel for D7, but it looks to have to do with the field. media_link doesn't exist in the display array of the returned field from:
Comment #10
finn lewisI too am looking at the D7 api changes for the first time trying to fix this for site I'm upgrading.
Line 82 of media.fields.inc defines the 'view modes'
So the
$view_modethat is passed to(line 353 media.filter.inc) does not match with those returned by
So, do the 'view modes' that the media module defines in media_field_view_modes need to match those returned by the field_info_instance function? If so, how best to approach this?
Any pointers or suggestions?
Comment #11
finn lewisI managed to get it working locally by replacing the 5 modes defined in
media_field_view_modes($obj_type)withI'm sure this is not the best way to fix it, but I am at the edge of my ignorance with the Field API.
So, is it just that the display modes are not defined properly? Should these be defined in another hook?
Also, I can't find any documentation about
hook_field_view_modes...Still confused.
Comment #12
Mac Ryan commentedJust a question out of pure curiosity in terms of development process... I read:
but I do not understand what's the logic. It would seem natural to me that - since the final D7 will be cloaser to Beta3 than to Beta2 one should focus on making the module working on Beta3, not Beta2. After all we are not talking about two different releases (D6 and D7) but between a buggy, unsupported version and the first "candidate to become release candidate".... anybody cares to explain what I am missing here?
Thanks! :)
Comment #13
JacobSingh commentedNot sure what you're asking but the media releases are lockstep with core to avoid people know what version will work with what core version.
Comment #14
Mac Ryan commentedMy question is: what's the point in testing a bug against B2?
If a bug is there against B3, that's what matters the most, as RC will be ~B3, and certainly more similar to B3 than to B2... Using a metaphor: from my point of view the bug report looks like: "The boat is too heavy and with the media module sinks" and the reply I quoted beforehand "yeah... that's because they have now installed the engines. Tests if without engines it is light enough to get the media module going".
As a matter of facts - though - the boat will have engines onboard... so I am just curious to understand what's the point in testing stuff without the engines (i.e. Beta2) as requested in the reply to the bug filing. Honest question... just trying to understand how the development cycle works! :)
Comment #15
mcaden commentedI thought Mac's explanation/metaphor was a bit odd but I get his point and agree completely. I had thought the exact same thing as he said in #12.
It doesn't make sense to maintain backwards compatibility on BETA releases. I can understand if, however unlikely, that there is a breaking change in core from 7.1 to 7.2 to maintain a separate branch. However I don't think this should be maintained in Beta. Current release and testing should always be developed with the latest beta release of core, then worry about branching only once version 1 is released. You might end up wasting time having to workaround something in beta 2 that is fixed in beta 3 or ignore something in beta 2 because it works but is really broken in beta 3 (like this thread).
Comment #16
michaelschutz commentedMac/mcaden, I think that reply about trying with beta2 was to me - I had listed that I was testing with beta1 (of the Module). If that's the case, then it's natural that he would say, "try beta2" - I took that as beta2 of the module, not core. I'm thinking we might just have been talking past each other a bit.
I have no doubts that every effort's being made at getting things working with beta3 of core. And I'm looking forward to it - I'm not a code monkey, so I can't help very much, sadly. But I think it's a great module, and will look forward to using it.
Comment #17
mcaden commentedAh, I think I see. JacobSingh's comment (#8) made it sound to me like the maintainers weren't bothering with the beta 3 version of drupal 7 yet and were instead just trying to get it to work with drupal 7 beta 2. Instead, I guess what he was meaning was that MEDIA beta 3 hasn't been released yet and that's the one we hope should be fully functional with the latest version of core.
Comment #18
Mac Ryan commented@Michael - Ok, that's all clear than... it was just a misunderstanding on what the Beta refers to. I also understand now why Jacob had an hard time understanding what I was asking for (sorry mcaden for the odd metaphor, it was my last resort!).
It should however be pointed out that the bug was filed against the *development version* of the Media Module, not Beta 2, and since the problem is with Drupal Beta 3, precisely because of what is written on the media page:
it is truly counter-intuitive to suggest to try Media-B2 in conjunction with Drupal-B3. :)
BTW: Does anybody knows what's the string ID of the HEAD version of the module to be used with drush? I tried:
drush dl media-7.x-1.x-HEADwith no joy... :(
Comment #19
mcaden commentedGetting back to the real problem, another observation about this for me:
Install Core D7 beta 2, Media D7 beta 1...upgrade core to D7 beta 3 and media to beta 2...seems to work
Install Core D7 beta 3, Media D7 beta 2...this issue appears
Comment #20
mcaden commentedAfter looking at what was being returned from field_info_instance the changes from ecofinn looked valid. I've made the changes he suggested above in #11 and did a little testing. This worked. I've rolled it into a patch and shortly I will be looking into what caused this to be a problem. (Where the original "link, preview, small, original, large" ones came from to begin with and where that might've changed)
Comment #22
JacobSingh commentedOkay, so here's the deal:
Acquia uses Media related modules in production http://drupalgardens.com
Every 3 weeks we update Drupal to the latest BETA and I try to push out a media release to go along w/ that beta. So I'm absolutely thrilled to see all bugs reported, but I just want people testing on a platform where the bugs are expected, or at least reporting as such. So if you're using core BETA-2, use media BETA-2, if you're using core BETA-3, don't expect any media version to work right now, but certainly don't use the BETA-2 release and report against that. Use HEAD.
To get the HEAD of a module, see:
http://drupal.org/node/19304/cvs-instructions/HEAD
Comment #23
mcaden commentedBAH,
TortoiseCVS FTL.
Re-rolled patch using straight cvs commands.
EDIT: This and the previous patch are the same, merely generated differently, and both are against HEAD
Comment #24
mcaden commentedComment #26
mcaden commentedBAH, I think this'll do it.
Comment #28
finn lewisFor the record, the patch in #26 works for me, despite it failing SimpleTest.
Comment #29
bjalford commentedComment #30
bjalford commentedignore above patch - wrong file
Comment #31
mcaden commentedAHA! I've been looking for WHY this is happening. I view the patch above as a workaround not a fix. I much prefer a fix.
So the following only applies WITHOUT applying the workaround patch....
To reproduce on HEAD:
Manual fix on HEAD: (not sure where to fix in code yet, here's how to fix in UI)
It appears that the module is trying to use display modes without them ever having been turned on. If you turn it on, suddenly it works.
Comment #32
mcaden commentedWhat I've done instead of removing some extra formats is instead, when we check to see if file formats are hidden - we check if they even exist in the data. This patch should do the trick. I'm screwing something up as I format my patches so it'll probably fail but it should be perfectly valid. If anybody knows how I'm screwing up my patches please enlighten me. This patch is made against a fully updated checkout of HEAD
Comment #33
mcaden commentedComment #34
mcaden commentedhmm...test system isn't picking up patch at all..I'm failing all over the place...I'm just going to stop worrying about it until somebody can tell me where I'm going wrong. Sorry for cluttering up the issues.
Comment #35
Wuk commentedI have been able to successfully patch dev version of this module, but I did get something that might seem like an error in a format of a patch file.
patching file media/media.filter.inc
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 259 with fuzz 2.
It seems that this is a fix for this bug.
Comment #36
mcaden commentedThis should fix the error in the patch file.
Comment #37
mcaden commentedIt still seems like we're treating the symptom rather than the cause but I prefer this solution over the first one.
Comment #38
mcaden commentedah, found where I've been screwing up the patches
Comment #39
JacobSingh commentedYeah, there is something else going on here... The Large and small styles should be showing up, but something changed and since they aren't custom it doesn't work, we need to find the root of this.
Comment #40
effulgentsia commentedAt some point along the way, D7 core changed such that field_info_instance() no longer returns data for every view mode, but only for ones that have settings. This patch fixes Media accordingly. There may be other places in Media that also need fixing, but this seems to address this particular issue.
Comment #41
JacobSingh commentedThis one perhaps?
Subject: Trying #886152 again: Fixed All fields are hidden after the administrator newly configures a view mode to not use 'default' display.
Parent: 40347e65e9715cca4bbd0cc55f1816df71d2fa9e
#886152: All fields are hidden after the administrator newly configures a view mode to not use 'default' display
Comment #42
JacobSingh commentedAbove patch doesn't quite work. IT stops throwing the error and shows all items in the drop-down, but it inserts the file_default for everything.
Comment #43
effulgentsia commentedNot if you install fresh. Or if you disable and re-enable the media module after applying the patch (since media_enable() re-configures the view modes / formatters). We could add an update function to the patch to also do this re-configuring, but I'm not too keen on overriding administrator choices (as a separate issue, we should move most of what media_enable() does into media_install()). If the administrator wants to un-customize the Large view mode, so that it uses the Default one, we should respect that.
Comment #44
effulgentsia commented.
Comment #45
mcaden commentedGlancing over the patch it appears sound. I'll test it on my sandbox shortly.
Comment #46
mcaden commentedLooks successful, I patched on an export directly from head and did a fresh install. Link, Large, Preview, and Original show up and all seem to act appropriately. The only problem I have is that the "preview" style actually enlarges a small portion of my image and makes it quite pixellated and ugly (image I tested on was banner-shaped: 332x90 but I think that's a problem with styles rather than media.
Comment #47
Mac Ryan commentedThe patch itself seems to work at far as installation and media upload are concerned.
However it is impossible to format images (haven't tried with other types of media) via the CKeditor "image" dialogue. Formattings like alignment and border are removed on submission of the node.
I am unaware to say if this problem has been introduced by the patch modifications or it is in the text filter that replaces the media tags with HTML markup.
Comment #48
JacobSingh commentedWe would need some type of update function...
Comment #49
JacobSingh commentedI committed #40, but would still like to followup w/ an update function to not break existing sites.
Comment #50
effulgentsia commentedAlso adding the "Needs tests" tag. We need to be increasing our test coverage of Media module, and adding tests as part of the issue which identified a bug has worked well for D7 core development, so let's try it here too.
Comment #51
effulgentsia commented.
Comment #52
gvc commentedSame issue occurs in drupal 7.0 full release. As mentioned in #1 It only happens when inserting media inline with wysiwyg button.
Comment #53
traceelements commentedYep, me too. Drupal full release in wysiwyg.
Comment #54
JacobSingh commentedOkay, so I don't know if I'm going to have time to write an update function. Is there anyone using this in production who wants one?
I am not able to replicate the problem. Here are my module version, please let me know what you've got if you're still getting it:
Core: 7.0
Styles: DRUPAL-7--1 (latest)
Media: HEAD
WYSIWYG: HEAD
Best,
Jacob
Comment #55
JacobSingh commentedIs this an issue when not using the media_dev profile? Is everyone using the profile?
Comment #56
james.elliott commentedI just installed without the media_dev profile. After configuring my text formats and WYSIWYG profile I had no issue inserting media through CKEditor.
Core: 7.0
Styles: DRUPAL-7--1 (latest)
Media: HEAD
WYSIWYG: HEAD
Comment #57
JacobSingh commented@gvc and others, *please* test again, and let us know what versions are broken when you re-post.
I'm renaming this to reflect the remaining work.
Comment #58
gvc commentedThanks for the fix, the critical error goes away with the below versions and a DB upgrade for Styles. Mine is not the media_dev profile.
Core: 7.0
Styles: DRUPAL-7--1 (latest)
Media: HEAD
Entity API : DRUPAL-7--1-0-BETA6
WYSIWYG: HEAD
Editor : CKEditor 3.5.0.6260
After uploading 2 images, there's a new issue. The uploaded media is not visible post submission, instead the below details are displayed:
"[[{"type":"media","view_mode":"media_large","fid":"15","attributes":{"alt":"","class":"media-image","typeof":"foaf:Image"}}]][[{"type":"media","view_mode":"media_preview","fid":"14","attributes":{"alt":"","class":"media-image","height":"120","typeof":"foaf:Image","width":"120"}}]]"
Comment #59
james.elliott commentedYou need to enabled the media filter for your text format in order to convert those codes to the media items.
Comment #60
traceelements commentedI tried uninstalling (I previously had the dev version installed) and reinstalling the Media module with the following:
Drupal core: 7.0
Media: 7.x-1.0-beta2
Styles: 7.x-2.0-alpha1
WYSIWYG: 7.x-2.x-dev (latest update)
Entity API: 7.x-1.0-beta6
CKEditor: 3.5.0.6260
When I went to enable the media module after reinstalling, I get this error:
FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of /home/spauldin/public_html/d7/modules/field/field.crud.inc).
After that, I tried the media inline insert anyway, and now when I click the media button in the ckeditor, I get "The requested page could not be found. " instead of the media upload/browser window.
Comment #61
xalexas commentedSame error here with:
Drupal core: 7.0
Media: 7.x-1.0-beta2
Styles: 7.x-2.x-dev
WYSIWYG: 7.x-2.x-dev
Entity API: 7.x-1.0-beta6
CKEditor: 3.3.0.5542
* Notice: Undefined index: media_link in media_format_form() (line 262 of /Applications/MAMP/htdocs/drupal7/sites/all/modules/media/media.filter.inc).
* Notice: Undefined index: media_link in media_get_file_without_label() (line 355 of /Applications/MAMP/htdocs/drupal7/sites/all/modules/media/media.filter.inc).
* Notice: Undefined index: settings in media_get_file_without_label() (line 357 of /Applications/MAMP/htdocs/drupal7/sites/all/modules/media/media.filter.inc).
* Warning: array_merge() [function.array-merge]: Argument #1 is not an array in media_get_file_without_label() (line 357 of /Applications/MAMP/htdocs/drupal7/sites/all/modules/media/media.filter.inc).
Comment #62
olax commentedI have the same problem as mentioned in #61 and other posts here.
My setup is this:
Drupal core: 7.0
Media: 7.x-1.0-beta2
Styles: 7.x-2.x-alpha2
WYSIWYG: 7.x-2.0
Entity API: 7.x-1.0-beta6
TinyMCE: 3.3.9.3
Comment #63
effulgentsia commentedRe #61 and #62: I updated the project page to clarify that media beta 2 works with drupal 7 beta 2 only, and I made the 7.x-1.x-dev snapshot release visible, since that's the only version that works with 7.0 until we release a 1.0.
Comment #64
xalexas commentedThanks. I have updated Media, Styles and Entity to the latest dev versions and it's working now!
Comment #65
olax commentedThank you effulgentsia! After installing dev-version and clearing cache it started working. :)
Comment #66
aaron commented#46: "The only problem I have is that the "preview" style actually enlarges a small portion of my image and makes it quite pixellated and ugly (image I tested on was banner-shaped: 332x90 but I think that's a problem with styles rather than media."
this should be resolved in the latest release of styles.
Comment #67
effulgentsia commentedResetting issue attributes to reflect original issue. New issue for expanding test coverage: #1026532: Write functional tests for adding Media to WYSIWYG.
Comment #69
Kreativs commentedI get the following error when using the add media in wysiwyg :
[[{"type":"media","view_mode":"media_original","fid":"34","attributes":{"class":"media-image","typeof":"foaf:Image"}}]]
My setup is:
Drupal core: 7.0
Media: 7.x-1.x-dev
Styles: 7.x-2.x-dev
WYSIWYG: 7.x-2.0
Entity API: 7.x-1.x-dev
CKEditor 3.5.1.6398
(All ofthe above up to date Feb.08.2011)
Re #59
"You need to enabled the media filter for your text format in order to convert those codes to the media items."
How do I do this ?
Re #65
"clearing cache"
Is that the views cache ? (tried that without luck)
Any help is appretiated !
Tor
Comment #70
mcaden commented@TMH - That's not an error - that is the output of the Media module. Go into /admin/config/content/formats and click "configure" for each of your formats that will use media and check the box that says "Converts Media tags to Markup"
Comment #71
Kreativs commentedThanks for your help on that , I have now checked that box , and the message dissapear.
But the image doesnt display unfortunately , neighter in teaser or when I click "read more" but if I click edit then I can see the image in the body in the edit mode.
(The field display of the content type Article is at default values)
Nice if you have a tip for this too
Thanks in advance
Tor
Comment #72
Kreativs commentedFigured it out , had to adjust the filtered html so it alows media
anyways thaks for your help :)
Comment #73
Kreativs commentedAnyone have problems aligning image ? ( or set other properties)
when I right click and set properties to an image to align to left, it looks ok, but when I save it remes that property and is unaligned again.
I think this is a problem with the filter : "Converts Media tags to Markup"
because it works if I remove that filter. (but then I cant use media to browse for images)
Comment #74
mcaden commentedYou shouldn't be using a closed issue as your place to ask questions about totally unrelated issues.
To answer your question, you could've easily done a quick look on other issues to find issues like #1043570: Floating images left and right or make sure if you're using divs to align the images that you're using full html and not filtered html because "div" isn't allowed in filtered html.