Strongarm is weighted at -1000 to run before all other modules. Features_override uses hook_strongarm_alter() to override variables, but features_override_strongarm_alter() is not available during strongarm_init() as it is declared dynamically in features_override_init().

Setting features_override weight to -1001 allows features_override_strongarm_alter() to be declared before strongarm_init() is called.

We had an issue where attempting to override featurized strongarm variables would alter the rendered defaults, but would not alter the variables at runtime.

This probably isn't the ideal solution, but this is the only way we could get it to work on a stock D6 install.

Comments

nedjo’s picture

In 7.x we are no longer dynamically declaring the alter functions.

I also recently talked with a couple of devs at Phase2 and it seemed like they were mulling the possibility of having a universal features component alter hook, to avoid the need to declare a separate one for each component type.

I'd welcome a backport of the 7.x code to 6.x, but don't plan to do it myself.

scottrigby’s picture

Assigned: Unassigned » scottrigby

hi nedjo: i looked in 7.x-1.x to see how i could help with a backport… but looks like it's still the same? features_override_init() still dynamically loads strongarm.features_override.inc. Or did you mean something else?

nedjo’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

I originally wrote code to dynamically generate the alter functions and later replaced that with include files. I was mistakenly thinking I'd done this update only for D7, but I also did it for D6.

Moving this to D7 on the assumption it's going to be an issue there too and so shd be fixed first in D7.

I'm thinking for D7 the answer is to use the registry by adding the alter hook include files to the .info file's files array, rather than manually including them in hook_init(). Then they'll be loaded when they're needed. If for some reason that doesn't work, we could look at messing with hook ordering in hook_module_implements_alter().

With that in place, I'd be okay with a D6 approach that messed with the module's weight.

nedjo’s picture

Hmm, the registry won't in itself help. We could consider using hook_hook_info_alter().

scottrigby’s picture

Title: strongarm doesn't work unless features_override weight set to -1001 » features_override_strongarm_alter() not available during strongarm_init()

ok, committed the weight change to 6.x-1.x, changing title to describe the problem instead of the D6 solution – and leaving status the same until 7.x is solved in a different way

nedjo’s picture

k, thanks for the fix. Ideally though we should have fixed this in D7 before D6. Let's try to get a hook_module_implements_alter() fix in.

brad.bulger’s picture

Issue summary: View changes

i don't know what the state of this is, but there is no hook_strongarm_alter() in the 7.x version of Strongarm and Features Override is still trying to use it for "features_override_items" entries. Are those obsolete? They're still reported as potential overrides.

Are variable overrides supposed to be working in Features Override 7.x?

ciss’s picture

hook_strongarm_alter() is a generic hook_COMPONENT_alter() hook that is invoked e.g. in features_get_default().

ciss’s picture

We've noticed that reverting the overrides will not work, as hook_strongarm_alter() does not get invoked for the overridden variable components.
Instead one has to revert the overridden feature.