Use case/steps to reproduce: I have started working on a feature that will eventually contain a bunch of different configuration settings but for now it just has module dependencies. I create a feature with just module dependencies, save it and continue working. I go back to the features page to recreate the features with the views/contexts/variables/etc that I have added but it does not show up on the list.
This happens because the module is not recognized as a feature because module dependencies do not export a features[] line to the .info file (which is checked for by features_get_info()).
I have not peeked under the hood of features much but I have made an attempt at a patch which has features.features.inc export a dummy features[] line in order to get the module recognized as a feature.
Comment | File | Size | Author |
---|---|---|---|
#35 | features_894572_detection_test_35.patch | 1.41 KB | hefox |
#30 | features.894572-30_api_version.patch | 1.05 KB | mpotter |
#27 | features.894572-27_api_version.patch | 701 bytes | Grayside |
#27 | features.894572-27_api_version-short_comment.patch | 575 bytes | Grayside |
#25 | features-allow-only-deps-wdrush-894572-25.patch | 945 bytes | eporama |
Comments
Comment #1
wizonesolutionsYeah, I have come up against this too. It's really cuz no .module file is generated. Thus Drupal is like, ok move along now no module here. Basically, there must be a module for dependencies to make sense. Seems like your patch'll effectively do that :)
Good luck,
Kevin
Comment #2
andrewlevine CreditAttribution: andrewlevine commentedIn the latest version of the features module the .module file is generated when only dependencies are listed as part of the feature. My patch simply adds a features[] line to the .info file which gets it recognized
Comment #3
hefox CreditAttribution: hefox commentedSubscribe
I'd like a way to tell features something is a feature without having any specific features, to use feature hooks. It works atm by adding a features[][] = "", but it'd nice if there's a less hackish way for this, which would fulfill this also.
Comment #4
Grayside CreditAttribution: Grayside commentedI'm confused. If all you have is an empty module with some standard module dependency declarations, why does it need to be an official Feature?
To make use of the Features UI?
Comment #5
arithmetric CreditAttribution: arithmetric commentedI've seen this issue before, and agree it would be helpful to resolve it.
One scenario where this can happen is when you want to write some code first and add feature elements later (they may not be ready yet). The simplest way to create a nearly empty feature is to add a module dependency. However, as noted in this issue, it won't be recognized in the Features UI, so you can't add more elements this way.
Comment #6
Grayside CreditAttribution: Grayside commentedI routinely create features by writing a bunch of .module code, creating exportable elements, hand-editing my .info file, then running drush fu.
If that is an approach that works for you, #893360: Drush update/recreate (add components) is also worth looking at.
The issue here is that features does not recognize dependencies[] as features-specific, because it is not. And to maintain consistency with drush commands, adding a dummy feature when a dependency is noticed seems like a bad plan.
I would go with something like:
features[features_api][] = "api:1"
. This has long-term functionality, and should simply be added to every feature module.Feature modules generated via the UI will automatically insert this line. Features generated by hand will detect whether it is a feature based on export components and add this line.
Comment #7
andrewlevine CreditAttribution: andrewlevine commentedGrayside, I don't see it as a dummy feature. Features dependency resolution support and dependency interface certainly go above and beyond core dependencies. If a line has to be added to the .info to tell features module that the dependency support in features needs to be used in a particular feature I don't see that as particularly ugly.
However, if
features[features_api][] = "api:1"
or something like it makes more sense to put on all features, and we don't need that extra line, I'm fine with using that too. Would be great to get some consensus here and I'll roll a patch if necessary.Comment #8
hefox CreditAttribution: hefox commentedSounds like api:1 that will solve my use case also :).
Comment #9
Grayside CreditAttribution: Grayside commented@#7: The interesting stuff Features does with dependencies are all in the Features Creation & Admin UIs. I don't see the dependencies as they are recorded in the .info file being any different regardless of whether or not Features was involved, which is why I object to a special syntax for them.
I definitely agree that there is value in a standardized syntax to say "I am a Feature." I can foresee it's use on the command-line approach to Features.
Marking as Needs Work.
Comment #10
pearcec CreditAttribution: pearcec commentedSo is this what we are looking for?
Comment #11
pearcec CreditAttribution: pearcec commentedComment #12
pearcec CreditAttribution: pearcec commentedI just realized neither of these patches are going to work. It creates a conflicts when a second feature is added with this variable set. Going with the boorish
$export['features']['features'][$module_name] = $module_name;
Shouldn't harm anything.
Comment #13
pearcec CreditAttribution: pearcec commentedMy colleague dking informed me my patch sucks because it doesn't follow the standard Drupal process for patch submission. I rerolled it proper.
Comment #14
Grayside CreditAttribution: Grayside commentedAgain, I would like to suggest something like #894572-7: Features with only module dependencies not recognized as features as a viable answer that has additional benefits in API version specification.
Also, in case that's confusing, I think my position has shifted slightly. I do understand the value of this, I just think rather saying Features=TRUE, I want Features=Compatible API Version
Comment #15
hefox CreditAttribution: hefox commentedfeatures[features_api][] = "api:1" looks good like a good idea to me also
Comment #16
hefox CreditAttribution: hefox commentedThis is sorta getting into feature request area, which is something that should go into 7.x first
Comment #17
pwaterz CreditAttribution: pwaterz commentedI too would like features to do this. I don't believe this to be a feature request. If I go into features and dont add any dependencies, and create the feature, it downloads a feature module, but that module doesn't show up in the list. So basically you can never add dependencies to it again. I would consider this a bug.
Comment #18
Grayside CreditAttribution: Grayside commentedYes, the UI bug is allowing you to create a Feature with only module dependencies :)
Adding a features designator to the .info file makes it reasonable to create a Feature with just dependencies, though what we're truly talking about is opting in a very, very, very minimal module to be managed and extended by the Features UI.
In the sense that instead of fixing the UI bug, we're adding new functionality that allows any module to be treated as a Feature, this is a Feature Request. In short, an enhancement to resolve an inconsistency, rather than eliminating the inconsistency.
Comment #19
garphy CreditAttribution: garphy commentedEven if it can be considered as a bug or a design flaw, I think it's still useful to define features by defining only a bunch of dependencies in UI and then add some configuration stanzas in the feature_name_enable / feature_name_install hooks to workaround some module for which there's still no Feature export ability and/or never will be.
Comment #20
Grayside CreditAttribution: Grayside commentedWe've more or less decided how to fix this, what's waiting now is someone that is especially interested to provide a patch.
Comment #21
eporama CreditAttribution: eporama commentedHere's a patch that implements
features[features_api][] = "api:1"
Comment #22
Grayside CreditAttribution: Grayside commentedI'm of two minds about this. On the one hand, the API version is kind of a dependency, on the other, this seems like something Features should directly be sure is part of every Features-generated module, without it being buried in dependency handling.
Comment #23
eporama CreditAttribution: eporama commentedIf we want it to be universal, would this be a better location for it?
Seems to effect the same overall need, but now adds it to all feature exports even if there are no dependencies. It does seem like a reasonable thing to add, especially if we ever get to an API version 2...
Comment #24
Grayside CreditAttribution: Grayside commented#23 doesn't work. Nothing functional about feature generation can be part of the form workflow. Test case would be to use drush and get the same results as the UI.
Comment #25
eporama CreditAttribution: eporama commentedwell, in that case, let's try this one?
Comment #26
hefox CreditAttribution: hefox commentedThat looks like the correct place to me; I was going to suggest it earlier, but was too lazy to look up the exact function name *whistle*.
Since features array for info gets remade, this will be re-added each time, which is fine so won't have any problems upping the api version.
However, comment could use some work; I personally don't think the initial reason it was added is necessary (people can look up the issue number in the commit that added it). Also, complete sentence, period at end!
tl;dr: Generally seems good other than comment
Comment #27
Grayside CreditAttribution: Grayside commentedAgreed, didn't notice. I consider the fact that this fixes the issue to be a secondary benefit.
Rerolled with two options: minimal comment and one more descriptive of the effect.
Comment #28
mpotter CreditAttribution: mpotter commentedWorks for me. I personally prefer the longer comment.
We also should note that existing features without this line will continue to work, so if somebody decides to rely upon the api version information being saved here just remember that older features might not have this line (until they are re-exported).
Comment #29
Grayside CreditAttribution: Grayside commentedWe should probably add a helper function for
features_get_feature_api_version()
and default nothing to "1". Can wait until we have a practical use case for using the version.Comment #30
mpotter CreditAttribution: mpotter commentedI wasn't keen to add a whole new function for the API until we saw some practical use cases. But instead I created the FEATURES_API constant in the .module file so it's not hardcoded in the export module. Went ahead and rolled that change into the commit. I've attached the final patch here.
Committed e894f12.
Comment #31
hefox CreditAttribution: hefox commentedThink it's needed for 6.x also
Comment #32
tsvenson CreditAttribution: tsvenson commentedLets keep this one for 7.x and add a backport tag instead.
Comment #33
hefox CreditAttribution: hefox commentedIt was already committed to 7.x
Comment #34
tsvenson CreditAttribution: tsvenson commented@hefox: Sorry man, totally missed that...
Comment #35
hefox CreditAttribution: hefox commentedTest for detecting features and that the key is added. Fairly straight forward, not sure how useful bug shrug.
Comment #37
mpotter CreditAttribution: mpotter commentedSee if we can bump this into 7.x-2.x to run the tester autobot.
Comment #38
mpotter CreditAttribution: mpotter commentedComment #39
mpotter CreditAttribution: mpotter commentedComment #49
mpotter CreditAttribution: mpotter commentedPassing tests, so marking this additional Test as RTBC.
Comment #50
mpotter CreditAttribution: mpotter commentedCommitted to d0c34a5.