I'm having a problem trying to export Entities from modules that provide Features support through Entity API. I have the same issue with both the Entity Registrations and Profile2 modules.

See #1418020: Features exportable support for Registration Entity for more info. But essentially the problem is that the exportables only appear to features directly after a cache clear, and when you try to export the entity into a feature, the exportable info disappears mid export, resulting in a Features error "An illegal choice has been detected. Please contact the site administrator". Clearing the cache makes the exportable info visible to features again, but after trying another export it disappears again mid export and the same error prevents the export from completing.

The is with the latest stable release of Registration and Profile2, and the latest git code of Entity API and Features.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lliss’s picture

Status: Active » Needs review
FileSize
329 bytes

tim.plunket helped me find a solution to this. Looks like the features integration for entity is only getting loaded after cache clears because it's not explicitly being called from within the entity.module file. An explicit module_load_include seems to fix this. A patch is attached.

mrfelton’s picture

Status: Needs review » Needs work

This patch does not resolve the issue for me. No change.

mrfelton’s picture

Status: Needs work » Needs review
FileSize
876 bytes

Try with this one. Seems to do it fo me.

fago’s picture

Status: Needs review » Needs work
+++ b/entity.module
@@ -7,6 +7,7 @@
+module_load_include('inc', 'entity', 'entity.features.inc');
 

This should be unnecessary as we have the 'file' specified now. Let's keep the features file only included if needed.

mrfelton’s picture

Will hook_features_api still be called even if its in the other file, or would that function need to be moved to entity.module? Does the files[] entry in the .info file enable module hooks to be located in files other than *.module?

fago’s picture

Status: Needs work » Fixed

Nop, that's done via hook_hook_info() of the features module. I ran into the issue myself and was able to verify that the patch of #3 minus the line mentioned in #4 works.

-> Committed, thanks.

Status: Fixed » Closed (fixed)

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

Everett Zufelt’s picture

FileSize
719 bytes

Adding patch that includes only first hunk from #3.

jackbravo’s picture

This is not working for me with latest dev. The 'file' key on hook_features_api doesn't seem to imply that you can put your hook_features_api implementation also in that file.

For me only moving hook_features_api function to the .module file solves the issue. The entity that I'm trying to export is a search_api entity.

jackbravo’s picture

Could this issue be the culprit? http://drupal.org/node/977052