Closed (fixed)
Project:
FileField
Version:
6.x-3.1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Aug 2009 at 16:37 UTC
Updated:
30 Jun 2010 at 01:55 UTC
This can be useful when calling the formatter manually or via drupal_render().
Imagine that you want to render several filefields (or an imagefiled) inside
the node content, and you want some of them inlined with the text, some as
blocks, some floated to the left, some floated to the right, all you have to
do is pass an extra class id to the formatter, and leave the rest to the CSS
layer.
I plan to use this feature in #394682: CCK fields (filefield,imagefield,emfield) and fieldgroups for Inline API with code like this:
content_view($node, $teaser);
// Render the first filefield, this is just an example :)
$file = $content['field_file']['field']['items'][0]['#item'];
// Always render the file
$file['list'] = 1;
// Add an extra CSS class
$file['attributes'] = array('class' => 'float-right');
echo drupal_render($file);
phpIf the idea looks acceptable, I can work out a better patch than the one attached, and propose something similar for imagefield as well.
Thanks,
Antonio
| Comment | File | Size | Author |
|---|---|---|---|
| filefield-pass-extra-CSS-class-to-formatter-d6_v1.patch | 1.6 KB | ao2 |
Comments
Comment #1
pribeh commentedBump.
Comment #2
ao2 commentedPIng.
Comment #3
quicksketchThis is unlikely to be added. FileField has been moved into Drupal core and I'd really recommend handling this in your theme anyway.
Comment #4
quicksketch