Closed (fixed)
Project:
D7 Media
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
21 Dec 2012 at 21:42 UTC
Updated:
29 Jan 2013 at 15:50 UTC
Jump to comment: Most recent file
In order to make media items easier to theme inside wysiwyg containers additional classes should be on the element.
This could be done in media_token_to_markup(). There is a note in this function about the concern of media elements not being wrapped in divs under some conditions. Perhaps we should supply some default CSS that displays items inline.
This patch adds a unique ID and media classes.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | media-add_classes_to_classless_div-1872420-9.patch | 1.07 KB | ParisLiakos |
| #5 | media-add_classes_to_classless_div-1872420-5.patch | 1.03 KB | ParisLiakos |
| #3 | media-add_classes_to_classless_div-1872420-3.patch | 1020 bytes | ParisLiakos |
| media.diff | 268 bytes | arthurf |
Comments
Comment #1
ParisLiakos commentednot sure about id, since same file can be embedded more than once in the same page..but i agree on classes
Comment #2
arthurf commentedPoint taken about the id. It may also be worth adding some supporting classes for the view mode and the image style:
Comment #3
ParisLiakos commentedhmm i wanted to avoid div there when no additional fields are there so p tags wont break...eg if we have
<p>lorem ipsum <img /> lorem</p>surrounding img in div would make it impossible to make it display inline...updated comment to explain this better
Comment #4
ParisLiakos commentedComment #5
ParisLiakos commentedhmm, should actually reset $attributes, since it is being used, before in the same scope
Comment #6
arthurf commentedI'm wondering if we need another class such as media-element that designates this particular thing as something that media has inserted on the page. I like that you added media-STYLE. I'm just concerned that media by itself maybe overloaded- #content .media {...} might be too broad.
Personally I'm concerned about using different markup for elements that have fields and those that don't- I think it breaks some assumptions that we have about page markup and make theming more challenging. If the need is for inserted elements to be displayed inline let's add some css to handle that. But I'll save that argument for a new issue :)
Comment #7
ParisLiakos commentedI couldnt agree more:) we need to find a way to make markup output consistent..also see #1807832: Add wrapper class input to media filter
media-element class is currently used as class on files..i see now
<img class="media-element" />i think it does not make sense having the same class in the wrapper div and the file itself. maybe introduce a new class,
media-wrapperor movemedia-elementclass from file to wrapper divComment #8
arthurf commentedPersonally I don't think the img should have a class of media-element- it is only one part of the element that is being put on the page- the fields are part of that element as well. I would like to see this only on the container div and not on the element itself- however this has the possibility to break people's theming if they've already started using it. I'm not sure what the policy on markup changes and releases is but if we do this we'd need to document it.
In the meantime, can we use media-element-container on the container div and not change the rest of the markup in this issue? Then we can maybe tackle making all the generated markup the same!
Comment #9
ParisLiakos commentedAgreed as well..img should not have any class..but i am pretty sure people use it already..lets discuss this as well in another issue, where we ll decide the overall markup of embedded media elements..
Patch attached adding media-element-container class..did not tested but i guess it works:)
Comment #10
arthurf commentedI tested this under these conditions:
* node published
* node unpublished
* node with multiple images in the body field
* node with multiple images with some formatters that display fields
Each test returns the expected value. Inserting a PDF did not work as expected, however since these are displayed as links by default this maybe the expected behavior, I'm not sure. Since this patch does not alter that behavior it is probably ready for commit though someone should probably verify that this is the desired behavior.
Comment #11
ParisLiakos commentedhttp://drupalcode.org/project/media.git/commit/133fe60
Follow up here: #1885432: Figure out a way to keep markup output consistent in media embeds
Comment #12
bbinkovitz commentedMaybe we should call those media elements that contain sub-elements "media compounds"? :-P