The recent 2.0-rc4 update of features has changed the signature of hook_features_export_options to require the feature as the first parameter, whereas entity takes the entity_type as the first parameter. The signature of entity_features_export_options should probably change to accept the feature as the first parameter, and the entity_type second.
The error occurs with v1.2 and v1.x-dev of entity.
The error arises when trying to create a feature, giving the error message "Notice: Undefined index: entity keys in __construct() (line 31 of /vagrant/src/sites/all/modules/contrib/entity/entity.features.inc)"
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | hook_features_export_options-2104461-21.patch | 673 bytes | deciphered |
| #21 | interdiff.txt | 1018 bytes | deciphered |
| #19 | entity_features_export_options.patch | 771 bytes | scottpayne |
| #16 | entity_features_export_options.patch | 781 bytes | scottpayne |
| #3 | entity_features_export_options.patch | 436 bytes | scottpayne |
Comments
Comment #1
scottpayne commentedComment #3
scottpayne commentedFix to patch formatting.
Comment #4
boobaaRan into the same problem, and #3 solved it for me. Thanks!
Comment #5
jstollerI second the motion! This worked like a charm.
Comment #6
dema501 commented#3 works for me, thanks
Comment #7
geerlingguy commentedDitto. RTBC +1.
Comment #8
RyanPrice commentedJust adding another +1 for patch #3. Tested and working for me.
Thanks!
Comment #9
alexweber commentedPatch works. Thanks!
Comment #10
rmanola commentedThe patch also works for me.
Comment #11
decipheredI'm not going to demote this from RTBC, but I wonder if it's worth giving some consideration to backwards compatibility?
Would be easy enough to wrap the function with a conditional to check what arguments it was passed and therefore determine if the first or second argument is in fact the $entity_type.
Ideally, Features should have not prepended the new argument, but it is what it is.
Comment #12
mpotter commentedThis is a side-effect of this patch in Features: http://drupalcode.org/project/features.git/commit/69df8e1fe9205afa74adad... where the dependency component needs to know the feature being exported.
Technically Entity API is at fault for adding it's own arguments to a Features API function that isn't documented to have any arguments. Features isn't "pre-pending" anything. It simply went from passing zero arguments, to passing the $feature being exported.
Looks like this didn't get fully tested and vetted in #2089113: Feature itself shouldn't be listed amongst its possible dependencies which I apologize for.
Since it's possible that this could cause problems with other modules and with backwards compatibility for Entity API, I'm going to revert this commit and roll a new rc5 release of Features later today. I did not intend to break any compatibility this close to a full release of Features 2.0.
Comment #13
mpotter commentedOK, I have reverted #2089113: Feature itself shouldn't be listed amongst its possible dependencies and released Features 2.0-rc5. No need to patch Entity API.
Comment #14
mpotter commentedActually going to re-open this issue.
Entity API should start adding code now to deal with this issue in the future. It's likely that Features 2.1 will add this argument again. Technically Entity API shouldn't be passing it's own arguments here, so please add some code to detect the first or second argument as $entity_type.
Comment #15
decipheredIgnore this
Comment #16
scottpayne commentedSeeing as I got the ball rolling I'll add a patch for backwards compatibility. It's a really naive test but does the trick when tested against Features 2.0-rc4 and 2.0-rc5.
Comment #17
scottpayne commentedComment #19
scottpayne commentedHmm... helps if I patch against the clean branch, not my already patched version >_<
Comment #20
vegansupreme commented#19 works for me!
Comment #21
decipheredDrupal coding standards update and possibly a couple pedantic amendments to the patch, but changed the argument names to more conform with Drupal standard when arguments may be one of many things ($a1, $a2, etc), uppercased the null, modified the comment to the correct length and removed unnecessary parenthesis.
Otherwise, the patch worked as expected.
Comment #22
ergophobe commentedPatch in #21 successfully applied and fixed the "unsupported operand" fatal error in with current dev of Entity and RC5 of Features.
Thanks!
Comment #23
alexweber commentedConfirmed that the patch works with Features 7.x-2.0
Comment #24
RyanPrice commentedAnother confirmation for patch #21 - works great.
Comment #25
socialnicheguru commentedYes it worked for me too.
Comment #26
fagoThanks, committed.