i'm working on a site which is essentially a user contributed multimedia resource server with some extras (faceted search, forums, blogs, file uploads OR url links, etc.).

We need the concept of a "resource", which will either be an uploaded file or url link to an online resource. Additional fields will be attached to it to help users filter down to the resource they are looking for.

My questions is, for the file uploads, which is the better approach? (A) Using a content type and adding a bunch of fields to it, including mutually exclusive file attachement field and URL field, or (B) attaching all the fields directly to the file types, and having a content type specific to URL links, with all the same fields attached to it.

Currently, I'm doing option A, and using the Media / File Entity modules for file management, the URL field module for the links, and the Conditional Fields module to select between file upload vs. url links.

The problem is that we need custom display handlers and the logic for all these test cases is getting really hairy. Files attached to nodes, urls attached to the nodes, optional thumbnails, does it link to the resource description page or the actual resource, and more.

I'm thinking that maybe by separating it out to put the fields on the files, I could create separate handlers with simpler logic that are easier to write and maintain. The biggest hurdle would be combining the files & nodes into one search, but that might be solvable via Search API multi-index searches.

What approach is the recommended way for working with File Entity / Media?

Comments

devin carlson’s picture

Status: Active » Fixed

I'd suggest using file entities individually with a content type that only has a link field and configuring your search service to index and search both.

If you want more consistency in how you handle the files + links, you might want to take a look at the Scald module which should allow you to, with the help of the custom provider or reference field, treat files and links in the same manner.

Status: Fixed » Closed (fixed)

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