Right now, we can't really render a file in any way in something like Panels, since we don't have any content types defined for CTools. Having some content types for this is very handy for people who wants to show files in panels, mini panels and so on.
The attached patch provides two content type plugins:
* A plugin that let's you view a full file that works like the node_content content type. This will let you display a full file in panels directly and select a view mode for it.
* A plugin for the actual file display. This plugin exposes the same functionality as you have when you change the file display for a view mode directly in the plugin. This is very neat, since you can create panels where you can put your file anywhere you want and change the configuration locally for that panel you are working on. The configuration for will then be exported together with the panel.
Comment | File | Size | Author |
---|---|---|---|
file-entity-ctools-content-types.patch | 8.55 KB | fabsor | |
Comments
Comment #1
emattias CreditAttribution: emattias commentedWorks great!
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedThis code looks good on visual review. It should be committed based upon #1.
Comment #3
logaritmisk CreditAttribution: logaritmisk commentedWorks for me.
Comment #4
ParisLiakos CreditAttribution: ParisLiakos commentedfile-entity-ctools-content-types.patch queued for re-testing.
Comment #5
ParisLiakos CreditAttribution: ParisLiakos commentedCan anyone confirm that this patch works with latest dev? havent commit this yet cause i have no exposure at all to panels etc, but i hate seeing it stuck in the queue especially when merlinofchaos approved it
Comment #6
theduke CreditAttribution: theduke commentedWhile the code looks good to me, I can not get the "File" category to show up when editing a panel.
I verified that the plugin files get loaded, and the plugin definition also should be working,
but it's not.
The issue is with "required context' => new ctools_context_required(t('File'), 'entity:file'),".
When I uncomment the line, the plugin shows up properly.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedThe content type requires a file entity context to appear; so it won't show up in just any panel. That's what that 'required context' line does, and that's how it's meant to work, typically. The content type displays information from that context; so without it, it's meaningless. And you don't WANT it to show up if it has nothing to display.
Comment #8
aaron CreditAttribution: aaron commentedfile-entity-ctools-content-types.patch queued for re-testing.
Comment #9
aaron CreditAttribution: aaron commentedCommitted to http://drupalcode.org/project/file_entity.git/commit/419319f