With the node module, there are a lot of modules which extend the node which features doesn't know about. For example the pathauto module adds to the content type but the parameters are not exported as well.
The 1st patch adds a new hook_features_populate_alter() which allows the $more to be altered and additional dependencies added.
The 2 other patches since the additional parameters are just variables, using the strongarm module they just add the variables to the pipeline so strongarm will pick these up and add them to the feature.
Since these are just variables adding features support for auto node title and path auto is only a few lines of code.
This also means that the modules implementing the feature do not need to directly know about the dependencies, and modules like cck could actually handle the addition to the pipe itself instead of having the code in the node.
Comment | File | Size | Author |
---|---|---|---|
#11 | alter-pipeline.patch | 1.51 KB | dmitrig01 |
#10 | alter-pipeline.patch | 1.52 KB | dmitrig01 |
#4 | 0001-Add-ability-to-alter-the-pipeline-so-other-modules-c.patch | 1.05 KB | gordon |
#4 | auto_nodetitle.patch | 799 bytes | gordon |
#4 | pathauto.patch | 812 bytes | gordon |
Comments
Comment #1
yhahn CreditAttribution: yhahn commentedI like this approach.
I discussed with jmiccolis a while back the fact that we'd made a design error - it's often not the object providing module that knows about its dependencies/associated objects but the extending modules. The solution I've been floating around for a while has been to pass every object to ever feature component provider - an expensive and overly complicated change. Let's see what he has to say about this change.
For now, what do you think of changing the alter to
features_populate_[component_name]
, the way a targetedform_alter()
works? This way there wouldn't need to be a component check within the implementing module's hook given that it's pretty unlikely it'll be altering more than one type of component.Comment #2
gordon CreditAttribution: gordon commentedYes I do like that idea of having a targeted hook.
I will make a change and upload some new patches
Comment #3
yhahn CreditAttribution: yhahn commentedSetting status.
Comment #4
gordon CreditAttribution: gordon commentedThis has taken me a while but here is an update.
I was thinking that we may want both hooks, like how form_FORMNAME_alter() and form_alter() but I don't think there will be as much overlap, and just mean we would have many small directed modules instead of large ones.
Comment #5
Cyberwolf CreditAttribution: Cyberwolf commentedExactly what I was looking for! Would be great to have this hook. Currently I need to go over the long list of variables with Strongarm and manually select the ones related to my content types.
Comment #6
brad.bulger CreditAttribution: brad.bulger commentedDitto, this is what I came here to figure out how to do. The last patch works great.
One question, that may be outside the context of this issue - how do you handle dependencies? For instance, if you are adding variables to the pipe, that only works if you have Strongarm enabled, yes? Or will Features just ignore those entries if Strongarm is not enabled, and so it's up to the feature creator to take care of that?
Comment #7
yhahn CreditAttribution: yhahn commentedIn my court to review now -- this looks very promising (and awesome) to me.
Comment #8
gregglessubscribe.
Comment #9
yhahn CreditAttribution: yhahn commentedOn my list.
Comment #10
dmitrig01 CreditAttribution: dmitrig01 commentedComment #11
dmitrig01 CreditAttribution: dmitrig01 commentedComment #12
yhahn CreditAttribution: yhahn commented@gordon the patch has been committed with a few tweaks:
http://drupalcode.org/viewvc/drupal/contributions/modules/features/featu...
The pipe alter hook looks like this now:
In addition, I know some people are interested in altering the export array once all population is complete and so we've split that into a separate hook:
Setting this to needs work so that you can update the integration patches you have above. Feel free to close when you are done.
Comment #13
codewaggle CreditAttribution: codewaggle commentedsubscribe
Comment #14
q0rban CreditAttribution: q0rban commentedsubscribe
Comment #15
phayes CreditAttribution: phayes commentedsubscribe
Comment #16
hefox CreditAttribution: hefox commented#897310: Features integration using hook hook_features_populate_COMPONENT_alter() for pathauto and #881170: Add Features support to Automatic Nodetitles for auto_nodetitle
(edit: wrong order u.u)
Comment #17
phayes CreditAttribution: phayes commentedBoth of these patches exist in other issues now. So i'm going to mark this issue as fixed to lessen any confusion.
Comment #19
tim.plunkettMarking as duplicate instead of fixed, that was confusing.
Comment #20
tim.plunkettEr, maybe not? Sorry all.