If a module provides Panelizer defaults exported through Features there currently seems to be no good way to alter or override these other than one-off solutions.

Features Override module depends on the Feature implementation providing an alter method but Panelizer does not specify one.

Going through the issue queue it seems like not supporting altering feature exported Panelizer defaults was an intentional decision on Panelizers behalf. I must admit I do not understand the reason but the current situation makes it difficult to build on modules providing Panelizer defaults.

Can anybody see a way for Panelizer to support altering defaults?

Comments

merlinofchaos’s picture

Status: Active » Fixed

Panelizer uses export.inc to handle its defaults and as with all modules that use export.inc, there is an alter hook for the exports.

I think the Panelizer default hook is named hook_panelizer_defaults; the alter hook would then be hook_panelizer_defaults_alter. Panelizer allows Features integration with CTools' export.inc to do its own thing.

merlinofchaos’s picture

Ahh, the "intentional decision" you link to has to do with the fact that Panelizer actually can create defaults automatically and according to pirog's research, we were able to allow features to go ahead and export those automatically created defaults that way. I know absolutely nothing about what that actually did to features to allow that to happen, other than knowing that it did.

kasperg’s picture

Title: Support for altering Panelizer defaults » Support Features Override
Status: Fixed » Active

I realize that the original title was not that fitting. It reflected that I'm unsure about how and where (Panelizer or Features Override) the issue should be fixed. I have updated the title to something which is hopefully more telling and reopening the issue.

The actual code causing the problem should be pretty clear:

/**
* Implements hook_features_api().
*/
function panelizer_features_api() {
  $api = array();
  $api['panelizer_defaults'] = _ctools_features_get_info('panelizer_defaults');
  $api['panelizer_defaults']['alter_type'] = FEATURES_ALTER_TYPE_NONE;
  
  return $api;
}

As mentioned by pirog the purpose of this is to prevent panelizer_panelizer_defaults_alter() from running when invoking features_get_defaults().

While setting $api['panelizer_defaults']['alter_type'] = FEATURES_ALTER_TYPE_NONE; may have fixed the problem at hand it also results in Panelizer not supporting Features Override.

Perhaps there is a better way to solve the problem regarding preventing panelizer_panelizer_defaults_alter() from running when invoking features_get_defaults()?

pirog’s picture

@kasperg

i share your optimism that there is a better way to solve this problem. when we originally disabled the alterability of panelizer default exports it was a tradeoff between that and actually getting these things to export correctly. for lack of the solution you seek we opted for the latter. i definitely wanted to dive in and see if we could get it to work with both pieces but as is often the case in open source i just never got around to it.

that all said... i actually need this functionality now so... here i am.

have you made any progress on this issue that might be relevant/useful to me before i give it a look-see again?

pirog’s picture

Status: Active » Closed (duplicate)

@kasperg

looks like this issue was actually addressed in #1912162: Panelizer does not support Features Override. worth reading to get some more insight on ALTER_TYPE.

also marking this as duplicate.