The file_entity should implement hook_entity_property_info_alter to provide metadata about the added type property.
This is needed, for instance, to allow the Search API to index allow filtering on file types (cf. #1196622: Indexing (and searching) a File Entity file type).
Comments
Comment #1
pbuyle commentedComment #2
drunken monkeyPatch looks good, as far as I can see. Didn't test it, though.
Comment #3
mikedillion commented#1: file_entity_entity_property_info_alter-1197450-1.patch queued for re-testing.
Comment #4
dave reidComment #5
dave reidComment #6
aaron commented#1: file_entity_entity_property_info_alter-1197450-1.patch queued for re-testing.
Comment #8
aaron commentedhere's a reroll. i'm not certain how to review it, since it's using the entity api hook and search api module, and i'm not too familiar with either module.
Comment #9
dave reidThis should be re-rolled to use the new file_type_get_names() function. Also, does entity.module implement hook_hook_info() so that this hook can go in file_entity.entity.inc?
Comment #10
drunken monkeyIt does implement the hook, but seemingly only for
hook_entity_property_info(), not for the corresponding alter hook. Seems like a case for an Entity API issue.Comment #11
dave reidFile entity has switched to a 7.x-2.x branch and the 7.x-1.x branch is no longer used. Please make sure to update your Git clones.
Comment #12
dave reidAnother re-roll based on the current code.
Comment #13
dave reidIncludes support for the creation and form callbacks too.
Comment #14
dave reidI'm not 100% sure on just using entity_metadata_create_object for the creation callback.
Comment #15
dave reidOk, the only thing I was uncertain about was if the create callback needs to support adding in the file mime type, but because file_entity_file_presave() does that automatically, I'm confident about putting this in as-is.
Comment #17
dave reidPushed #15 to Git. http://drupalcode.org/project/file_entity.git/commit/372ce37
My apologies to mongolito404 and aaron - in my rush to commit this, I forgot to give you mention in the commit message. :(