Now that comment is a fieldable entity type, it becomes possible to add fields to it, and end up with output such as illustrated below.

The point is to show that the HTML generated for the comment body does not play well with the field output because it does not have a wrapping tag like each field instance has. In Drupal 6, div.content was playing that role, but now div.content can contain pretty much anything and is not representative of the comment body alone.
One immediate drawback of this messy output is that themers don't have a direct CSS class to target the comment body without styling all the fields attached to comment. Another problem is that the RDFa property attribute which is currently located on the "global" div.content is not placed correctly: it is meant to annotate the comment body alone, so it will also include any other field instance content which is attach to the comment. Secondly, it cancels out all RDFa information contained in the children tags, including the rdf-meta tag and all the potential field RDFa annotations. We need to be able to move property="content:encoded" to a tag that only contains the comment body. This was one of the goals of #538164: Comment body as field but it's stalled at the moment. We need to work on an alternative solution in case it does not get committed.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 664602_comment_body_wrapper.patch | 1.08 KB | scor |
| comment_output_field.png | 63.67 KB | scor |
Comments
Comment #1
scor commentedstarter patch. This patch generates the right HTML output inline with the requirements above. This is the kind of output we get:
I think it would make sense to generalize the comment body wrapper to be in the comment module, and allow rdf.module to add its own RDFa attributes to it. But first I'd like to get some feedback on the general idea.
Comment #2
dries commentedLet me revisit #538164: Comment body as field first. Stay tuned.
Comment #5
dries commented#538164: Comment body as field was committed to CVS HEAD so this patch is probably no longer necessary.
Comment #6
dries commentedCorrection, that patch wasn't committed yet.
Comment #8
scor commented#538164: Comment body as field has been committed, this is now a duplicate of #652246: Optimize theme('field') and use it for comment body.