The forthcoming patch will display fields when embedding with WYSIWYG.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aaron’s picture

Status: Active » Needs review
FileSize
1.15 KB

Patch attached

tsvenson’s picture

Status: Needs review » Reviewed & tested by the community

Applied cleanly and fields are displayed according to settings in the admin/config/media/file-types/manage/image/display/* for the file type.

idenev’s picture

This is quite logical addition of functionality to the media filters. Displaying fields according to the display settings in the embedded object makes a lot of sense.
The problem I see with the patch is that attributes of the file entity are applied to the enclosing div. Seems to me that it is not exactly what should go there. For example, it produces markup like: <div class="file-entity-classes" width="180" height="180"><img..../><div of the fields>..</div></div>

Nick Lewis’s picture

This patch freaking made my day! Why isn't applied yet?

aaron’s picture

Status: Reviewed & tested by the community » Needs work

because of #3. makes sense. except for floats... what a tangle... maybe we can not print the height, but the others? (seems as though you would want to respect the width)

Nick Lewis’s picture

^ ran into a big problem with floats. I took an image and tried to float it. (using CKEditor styles dropdown). Here's what happens:

<div align="left" alt="" border="2" class="media-image" height="579" id="2" style="padding:5px;margin-right: 5px;" width="552"><img align="left" alt="" border="2" class="media-image" height="579" id="2" style="padding:5px;margin-right: 5px;" width="552" typeof="foaf:Image" src="http://p2.ubm-medica.gotpantheon.com/sites/default/files/images/kand3.jpg"><br>
<div>LOTS OF DIVS FOR CAPTIONS YAY</div>
</div>

I agree. Width is the only thing that makes sense. Have no idea where the 5px padding came from, but if we are going to have default padding that should be in a css file (so someone can change it). As far as I can see, if we just get rid of everything besides width, we're good. (besides img atr height,width,alt, any attributes that make sense, etc... ...).

Nick Lewis’s picture

A followup issue should probably be float control. Its a really basic feature that makes a difference to people who are new to drupal.

RobW’s picture

@Nick, I think #6 would be a CKEditor or WYSIWYG API issue. I don't believe Media ever adds or touches those attributes.

IMO floating or perfect WYSIWYG integration shouldn't be a blocker for this issue. The goal is to include media fields on insert, and plenty of people need that without extra styling, adding borders, etc.

SergFromSD’s picture

Hey I'm really confused here guys. I just installed 7.x-2.0-unstable5+0-dev today. All I've done is added an image file type to a node uploaded an image and entered a caption on the image. I know that my caption is being saved on the database because after uploading the image I can click edit and I see the caption I entered. Yet my caption does not display when I view the page. I'm just using the default the default Garland 7.12 (default theme).

How can I get my caption do display under my picture? Should this be happening automatically or do I need to

a) Create a view
b) Create a field formatter
c) Apply the patch listed here

Your help is much appreciated.

RobW’s picture

Have you tried applying the patch above?

SergFromSD’s picture

Hi RobW, I didn't apply the patch because I saw a date on the patch of January 30th and since 7.x-2.x-dev has a release date of May-20 I assumed it would have the patch included. Thank for clearing this out, I'll apply the patch and report back.

Sergio

Dave Reid’s picture

@senorbond: Make sure to read http://drupal.org/node/156119. Because this issue is not marked with status 'fixed' or 'closed (fixed)' it means it hasn't actually been committed yet.

SergFromSD’s picture

@RobW: I applied the patch but it did not fix the issue. According to my debugger, the function media_token_to_markup is not even getting called so the changes applied by the patch are not having any impact. Not sure where to go next since I don't know enough about drupal to know why media_token_to_markup is not being called. Maybe too much has changed between Jan 20 and May 20th in the media module. I can see from looking at the database that the caption text is being inserted into the field_data_field_caption, so at least I know that this is truly a display issue.

I wonder how other people have worked around this issue? I keep coming across field formatters so I think I will go learn how to create one or try using a different theme?

Any suggestions would be appreciated.

Sergio

sheena_d’s picture

Status: Needs work » Needs review

I applied the changes in #1 to 7.x-2.0-unstable3 and it worked perfectly. I also tested with applying floats to the image using CKEditor's image attributes, and I see no issues with the div layout or excess inline CSS. I'm guessing that this result will vary greatly from site to site.

If the maintainers could give me some idea of what additional testing they are looking for in order to mark this RTBC, I would be happy to work on it.

Devin Carlson’s picture

dddave’s picture

Status: Needs review » Needs work

Media has changed a lot since unstable3. :(

aaron’s picture

Status: Needs work » Needs review
FileSize
1.07 KB

this is a re-roll, that also does not print any of the attributes for now, because of the issues brought up in number 3. I think that this should be good to go, and we can get fancy things like width and floats in another issue.

Devin Carlson’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #17 applied cleanly and enabled the display of file fields when files were embedded in a textarea using WYSIWYG.

After taking a quick look at the patch, I'm not quite sure I understand why the fields should be wrapped in a classless div but it also doesn't cause any harm.

HaloFX’s picture

#17 worked for me. However almost every image I ever insert through WYSIWYG is floated, so it didn't help my display much. I remedied this by applying a class to the classless div. Not ideal, but it gets the job done on a site in desperate need of a UI for captions. I did note that is appears all the attributes ARE being output on the image, but not the caption. I was hoping they wouldn't be on the image from the description.

A somewhat related thought, if a class were applied to the div and there were an option to drop the width and height attributes, we would have the makings of a Responsive Image option for inline images, which doesn't yet exist for Drupal to my knowledge.

aaron’s picture

denix’s picture

There is any hope for a backport to 7-1.x?

ParisLiakos’s picture

@#21 i doubt

Shouldnt we show the fields in wysiwyg too though. not just when rendering on node_view? After all it is a WYSIWYG:)

I think this behavior might not been expected, by some users. Eg they embed an image only to see after saving that besides the image a couple of fields are also displaying, potentially breaking the layout.

aaron’s picture

@#21 no, there is a long-standing feature freeze for the 7.X-1.X branch.

@#22 I see what you're saying. However, if we do that, we need to make sure that it is done in such a way as to let the editor know that the value is auto generated, and effectively read-only from the WYSIWYG. That could be a UI challenge in any of the WYSIWYG editors, let alone for all of them.

ParisLiakos’s picture

Status: Reviewed & tested by the community » Fixed

you are right, commited this for now, lets all play with it and think whats the best way to solve floats and editor experience
http://drupalcode.org/project/media.git/commit/1b7be58

ParisLiakos’s picture

FileSize
869 bytes

if someone cant decide how would be better to render in frontend, this is a patch that removes the divs in case the image lets say is surrounded by

and

breaks it...but still we have to come up with a smarter solution to cover not breaking layout when fields are present
Rob_Feature’s picture

I think the first step is to agree that we put some additional field in the media dialog where the view mode is chosen. I'm not sure we'd want to limit it to a float selector since it would limit it's functionality. I'm thinking a simple textfield where you can enter comma separated CSS classes. Those get added to the empty div and you can do anything you want to them.

(is there a new issue for this since it's marked as fixed?)

ParisLiakos’s picture

no, no followup has been opened yet,
please feel free to open a new issue with a link here, thanks:)

see #1807832: Add wrapper class input to media filter

Rob_Feature’s picture

per my previous comment, see #1807832: Add wrapper class input to media filter

rootatwc beat me to it :)

Status: Fixed » Closed (fixed)

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