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.

CommentFileSizeAuthor
file-entity-ctools-content-types.patch8.55 KBfabsor
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

emattias’s picture

Status: Needs review » Reviewed & tested by the community

Works great!

merlinofchaos’s picture

This code looks good on visual review. It should be committed based upon #1.

logaritmisk’s picture

Works for me.

ParisLiakos’s picture

ParisLiakos’s picture

Can 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

theduke’s picture

While 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.

merlinofchaos’s picture

The 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.

aaron’s picture

aaron’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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