Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm not sure if this is a duplicate - there seem to be several other issues with roughly similar complaints, but none that matches our issue exactly.
We have a node type definition in one Feature (A), with fields for that node type defined in another feature (B). Unfortunately, Feature A shows some of its components as overridden, and claims that feature module B is now a dependency of feature module A.
We're not sure how to tell Feature A to ignore the content of Feature B.
Comment | File | Size | Author |
---|---|---|---|
#19 | features_1489456_feature_suggestions_19.patch | 29.62 KB | hefox |
#17 | features_1489456_feature_suggestions_17.patch | 49.61 KB | Grayside |
#15 | features_1489456_feature_suggestions_14.patch | 29.28 KB | hefox |
#13 | 1489456_features_suggestions_13.patch | 22.72 KB | hefox |
#12 | 1489456_features_suggestions_12.patch | 21.52 KB | hefox |
Comments
Comment #1
Cameron Tod CreditAttribution: Cameron Tod commentedComment #2
hefox CreditAttribution: hefox commentedMy fault :(
Possible solutions:
Solution a:
Remove the line at the bottom should fix it. Whether something should add a dependency or not is complicated to guess. Keep getting false dependencies.
Solution b:
Remove from node_features_export
Solution 3:
Add some detecting to live above to not pipe in already defined fields.
Solution 4:
Change piping to somehow indicate "this is suggested by not dependency, so only add if not already defined" "This is a dependency and needed for this feature to work"
So what's needed is either removing or change the dependency detection or make piping smarter to know whether things are dependent part of the feature or just suggestions.
Comment #3
hefox CreditAttribution: hefox commentedThis is a quickie, untested, probably-has-a-syntax-error patch for solution 4.
Not happy with it.
Comment #4
hefox CreditAttribution: hefox commentedHad some extra stuff
Comment #5
Cameron Tod CreditAttribution: Cameron Tod commentedDoesn't seem to work in our case. If it helps at all, the dependency override is in the views component of the feature.
Comment #6
Cameron Tod CreditAttribution: Cameron Tod commentedActually ignore that, I don't think the patch applied to my copy of rc1.
Comment #7
Cameron Tod CreditAttribution: Cameron Tod commentedThe patch was missing a closing bracket, here's a copy with it back in.
Comment #8
Cameron Tod CreditAttribution: Cameron Tod commentedOK, so it appears that this patch fixes the issue as posted, thanks! :)
I'm having other issues with weird overrides on other types of elements, but I'll try to work out exactly what is happening before I post a bug.
Comment #9
hefox CreditAttribution: hefox commentedSolution 5) Add a new hook called hook_features_export_suggestions (eventually that can be configured to run or not [so those that don't want non-dependencies items added can opt out]).
Totally favoring this idea now.
Comment #10
hefox CreditAttribution: hefox commentedThis is sleep deprived take 1 on solution 5, which is prob what should have done originally with _features_resolve_depenenencies logic. There was quite a bit of extra code that should have removed originally from the respective hook_features_export; all code checking if item was already exported to another wasn't needed anymore so a lot of moving around was due to that.
Needs documentation (introduces a hook, changes purpose of another sorta)/testing.
There is api addition, but not removal.
Api addition hook_features_pipe_suggestion (not really attached to that name) + alter hooks: component hook where components can suggest additional items to complete this export (i.e. node suggest fields, views/contextes can suggests content types) that are not required for basic operating of the module.
This allows processing for any duplicates, but indicates the items are not required so 'gracefully' disappear from the suggested. Existing pipe/export hooks should generally still work, but may be vulnerable to this issue till updated.
So tl;dr: new suggestions hook, pipe and features_export to be focused on adding items required for basic functioning.
Comment #11
Cameron Tod CreditAttribution: Cameron Tod commentedThanks for this. As tested it solves the fields issues but the image style and views dependency stuff is still reporting overridden.
Interestingly enough, the old features have a dependency like this:
which are now showing as overriden, as they are no longer part of the 'current' feature.
I have done only very rudimentary testing.
I have some work to do today on some other bits and pieces but I'll try to play around with the new hooks and changes to see if I can massage things just right.
Comment #12
hefox CreditAttribution: hefox commentedAre you on latest dev? I suspect that is related the recent ctools api issues.
Here's a new patch with features.api.php updated.
Comment #13
hefox CreditAttribution: hefox commentedHad added a new function around export options calling, so updated other places to use that function
Comment #14
Cameron Tod CreditAttribution: Cameron Tod commentedNope, we're on rc1, will move to rc2. We need to maintain a stable module release set for our production sites but I can test ctools dev locally to sort out this bug. Gimme a bit...
Comment #15
hefox CreditAttribution: hefox commentedTests were missing
Comment #16
Grayside CreditAttribution: Grayside commentedTested and it works.
Now on to bikeshedding and petty issues. (Posting this, will reroll the patch with at least some of these changes next.)
features_test_additional Not the greatest name, but I can't think of anything better. Would like to see a better desription for the module and a /tests directory readme that explains both features_test modules and what they are for.
Agreed, hook_features_pipe_suggestion is a bit of a strange name. It's not so much suggesting pipes as it is suggested components for the feature, which it does by adding them to the pipe. Separate hook from hook_features_pipe_alter() is intended to maintain backwards compatibility, but let's clarify names more. hook_features_component_suggestion?
And some minor bits:
whitespace eol
whitespace eol
Other issue followup--examples that use generic words like "component" only help developers that have already figured out what we mean by component.
Would move explanation of pipe to end and expand to full sentence instead of a couple words in parentheses. (Also, spelling of dependent)
whitespace eol
Move an explanation of the pipe to next paragraph and expand. Can reuse text from above.
in_array($needle, $haystack)
provided by what?
Grammar a bit fuzzy.
whitespace eol, this and another ten or so below.
Comment #17
Grayside CreditAttribution: Grayside commentedAddressed most of the concerns. In the end, could not identify a better hook name (my proposed would have confused hook_pipe_COMPONENT_alter() and hook_component_suggestions_alter() a little to close for comfort.
Also, didn't feel like writing a README for the testing section, but did bundle features_test into it's own subdirectory to clean things up.
Comment #18
kclarkson CreditAttribution: kclarkson commentedI applied the patch in #17 but it did not clear my conflicts.
Comment #19
hefox CreditAttribution: hefox commentedThis is a patch against latest head + #1537838: Upgrading to 7.x-1.0-rc2 (from rc1) breaks taxonomy creation
It also removes the move of the feature features_test to folder features_test to keep from conflicting again.
Comment #20
hefox CreditAttribution: hefox commentedwhite space issues
Comment #21
hefox CreditAttribution: hefox commentedYeaaa this is suppose to be module_exists($map[$item]) not module_exists($module_name)
*head desk*
Comment #22
mpotter CreditAttribution: mpotter commentedThis issue has languished and needs attention if it's still a problem. However, with the split of field_base and field_instance you shouldn't run into any problem anymore with fields in a different feature from the node.
Re-open this with an updated patch if this is still something needed in 2.x