A given panel can have multiple variants, with selection rules used to determine which one is used. They are queried in order of weight, and the first variant found with a successful selection rule is the variant which is used, so the weights are critical data (for instance, you need your special-case variants to be lighter than the 'default' variant you wish to fall through to if the special-case rules do not match).
In the case of the page_manager_handlers component (node_view and term_view panels, for instance), these variant weights are not exported and imported. Changing the weights does not change the status of the feature.
CTools definitely includes the variant weight (as $handler->weight) if I manually export a variant, so I'm guessing this is something which is missing from Features.
Comments
Comment #1
barraponto CreditAttribution: barraponto commentedI guess the $handler->weight refers to the page_manager handler, not the variant. But then, I don't know how to export them either. Just posting to say this bug bites me too.
Comment #2
Sergii CreditAttribution: Sergii commentedI just checked $handler->weight is the variant weight.
I manually put different weight to exported feature (in file) and after reinstailling the variants weights were precisely such.
Comment #3
Sergii CreditAttribution: Sergii commentedAnd the problem is that when ctools build object in ctools_export_load_object it takes weight not from page_manager_weights table, but from property 'weight' in 'page_manager_handlers'. Maybe these should be syncronized.
Comment #4
Sergii CreditAttribution: Sergii commentedHe-he, they did it on purpose, but forgot to include into export procedure. See
Comment #5
hefox CreditAttribution: hefox commentedSo, is this a ctools or features bug?
Comment #6
Sergii CreditAttribution: Sergii commentedAnd here's patch. Don't forget to clean cache before using.
Comment #7
Sergii CreditAttribution: Sergii commentedComment #8
hefox CreditAttribution: hefox commentedSo, tis a ctools issue.
Patch is done from root of site instead of root of ctools (cd to ctools directory and use --relative).
Comment #9
merlinofchaos CreditAttribution: merlinofchaos commentedThe weight should be properly handled with the task handler is loaded, not when it is exported. How could it possibly work correctly otherwise?
Comment #10
jweowu CreditAttribution: jweowu commented#6 re-rolled via a checkout of ctools
Comment #11
jweowu CreditAttribution: jweowu commentedI missed #9 while generating the patch. I'm guessing that means it's back to "needs work".
Comment #12
Sergii CreditAttribution: Sergii commentedIt's not possible to alter anything on the load stage: ctools_export_load_object
I tested again my patch and it seems it's not possible to revert weights if there's no appropriate database record.
Here's my idea is to add extra ['export']['load callback'] which simulates correct 'export_type' on the export stage.
Now ctools_component_features_revert checks the state and there's no ways to force deletion.
The patch is in the attachment.
Comment #13
Sergii CreditAttribution: Sergii commentedSorry, there's the relative one
Comment #14
Sergii CreditAttribution: Sergii commentedI tested moving of weight to 'load callback' and it works.
Another one patch.
Comment #15
tim.plunkettFunction summary must be one line, and start with a verb.
Missing @param and @return docs
Trailing whitespace
Comment #16
Sergii CreditAttribution: Sergii commentedDocumentation fixed. Please review.
Comment #17
merlinofchaos CreditAttribution: merlinofchaos commentedI believe this would be more efficient query-wise if we used the 'load subrecords callback' instead. Plus it should also be less code.
Comment #18
Sergii CreditAttribution: Sergii commentedI think it's not possible.
'subrecords callback' modifies only $cache variable which contains no $handler object if handler exported to code.
Comment #19
jweowu CreditAttribution: jweowu commentedRe-rolling #16 to apply cleanly.
Comment #20
jweowu CreditAttribution: jweowu commentedInitial testing seems good. For my node_view and term_view panels, drush features-revert now correctly sets the variant weights as they were when the feature was exported. I tried a few simple cases of re-ordering and reverting, and nothing unexpected happened.
Thanks Sergii.
Comment #21
acbramley CreditAttribution: acbramley commentedApplied patch #19, reexported my panels feature and weights are now correctly shown in the export, moved a variant around, then reverted and it went back to the correct spot +1 RTBC
Comment #22
jweowu CreditAttribution: jweowu commentedAs a follow-up, I haven't encountered any problems with this patch since installing it, so I'd call it "tested" at least.
Do comment 17 and 18 still need discussion? If Sergii is correct about that, and people are otherwise happy with the code, then this could presumably be considered RTBC.
Comment #23
Josh Waihi CreditAttribution: Josh Waihi commentedReroll with ctools 7.x-1.1
Comment #25
Josh Waihi CreditAttribution: Josh Waihi commentedWhoops, set the base dir as page_manager rather than ctools. Now fixed.
Comment #26
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted and pushed #25.
Comment #28
danielnolde CreditAttribution: danielnolde commentedDamn, though the commit exists, it doesn't seem to work (anymore?).
Variant weights of panel pages are not exported/reverted correctly (using ctools-7.x-1.3+3-dev, panels-7.x-3.3+41-dev and features-7.x-2.0-rc1.
Bad combination of module version, or can anyone reproduce that this still not working?
Comment #29
Begun CreditAttribution: Begun commentedI can confirm the same problem here. We are using:
Comment #30
acbramley CreditAttribution: acbramley commentedUsing:
Panels 7.x-3.3
Features 7.x-2.0-rc3 (you should at least upgrade this)
CTools 7.x-1.3
It works perfectly
Comment #30.0
acbramley CreditAttribution: acbramley commentedtypo/rewording