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.

Files: 
CommentFileSizeAuthor
#25 page_manager_weight_export-1371436-20.patch2.4 KBJosh Waihi
PASSED: [[SimpleTest]]: [MySQL] 58 pass(es).
[ View ]
#23 page_manager_weight_export-1371436-20.patch2.3 KBJosh Waihi
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch page_manager_weight_export-1371436-20.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#19 page_manager_weight_export-1371436-19.patch2.4 KBjweowu
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]
#16 page_manager_weight_export-1371436-13.patch2.3 KBSergii
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch page_manager_weight_export-1371436-13.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#14 page_manager_weight_export-1371436-12.patch1.83 KBSergii
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]
#13 page_manager_weight_export-1371436-11.patch2.2 KBSergii
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]
#12 page_manager_weight_export-1371436-10.patch2.46 KBSergii
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch page_manager_weight_export-1371436-10.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
#10 page_manager_weight_export-1371436-9.patch1.22 KBjweowu
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]
#6 300312_page_manager_7.x-1.0.patch1.48 KBSergii
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 300312_page_manager_7.x-1.0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

I 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.

I 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.

And 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.

He-he, they did it on purpose, but forgot to include into export procedure. See

<?php
/**
* Set an overidden weight for a task handler.
*
* We do this so that in-code task handlers don't need to get written
* to the database just because they have their weight changed.
*/
function page_manager_update_task_handler_weight($handler, $weight) {
?>

So, is this a ctools or features bug?

StatusFileSize
new1.48 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 300312_page_manager_7.x-1.0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

And here's patch. Don't forget to clean cache before using.

Status:Active» Needs review

Project:Features» Chaos tool suite (ctools)
Status:Needs review» Needs work

So, tis a ctools issue.

Patch is done from root of site instead of root of ctools (cd to ctools directory and use --relative).

The weight should be properly handled with the task handler is loaded, not when it is exported. How could it possibly work correctly otherwise?

Status:Needs work» Needs review
StatusFileSize
new1.22 KB
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]

#6 re-rolled via a checkout of ctools

Status:Needs review» Needs work

I missed #9 while generating the patch. I'm guessing that means it's back to "needs work".

StatusFileSize
new2.46 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch page_manager_weight_export-1371436-10.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

The weight should be properly handled with the task handler is loaded, not when it is exported. How could it possibly work correctly otherwise?

It'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.

<?php
/**
* Master implementation of hook_features_revert() for all ctools components.
*/
function ctools_component_features_revert($component, $module) {
  if (
$objects = features_get_default($component, $module)) {
    foreach (
$objects as $name => $object) {
     
// Some things (like views) do not use the machine name as key
      // and need to be loaded explicitly in order to be deleted.
     
$object = ctools_export_crud_load($component, $name);
      if (
$object && ($object->export_type & EXPORT_IN_DATABASE)) {
       
_ctools_features_export_crud_delete($component, $object);
      }
    }
  }
}
?>

The patch is in the attachment.

Status:Needs work» Needs review
StatusFileSize
new2.2 KB
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]

Sorry, there's the relative one

StatusFileSize
new1.83 KB
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]

I tested moving of weight to 'load callback' and it works.
Another one patch.

Status:Needs review» Needs work

+++ b/page_manager/page_manager.moduleundefined
@@ -697,6 +697,31 @@ function page_manager_export_task_handler($handler, $indent = '') {
+ * Since weight is duplicated across the tables:

Function summary must be one line, and start with a verb.

+++ b/page_manager/page_manager.moduleundefined
@@ -697,6 +697,31 @@ function page_manager_export_task_handler($handler, $indent = '') {
+ * ¶

Missing @param and @return docs

+++ b/page_manager/page_manager.moduleundefined
@@ -697,6 +697,31 @@ function page_manager_export_task_handler($handler, $indent = '') {
+  ¶

Trailing whitespace

Status:Needs work» Needs review
StatusFileSize
new2.3 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch page_manager_weight_export-1371436-13.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Documentation fixed. Please review.

I believe this would be more efficient query-wise if we used the 'load subrecords callback' instead. Plus it should also be less code.

I think it's not possible.
'subrecords callback' modifies only $cache variable which contains no $handler object if handler exported to code.

StatusFileSize
new2.4 KB
PASSED: [[SimpleTest]]: [MySQL] 51 pass(es).
[ View ]

Re-rolling #16 to apply cleanly.

Initial 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.

Applied 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

As 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.

StatusFileSize
new2.3 KB
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch page_manager_weight_export-1371436-20.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Reroll with ctools 7.x-1.1

Status:Needs review» Needs work

The last submitted patch, page_manager_weight_export-1371436-20.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new2.4 KB
PASSED: [[SimpleTest]]: [MySQL] 58 pass(es).
[ View ]

Whoops, set the base dir as page_manager rather than ctools. Now fixed.

Status:Needs review» Fixed

Committed and pushed #25.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Damn, 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?

I can confirm the same problem here. We are using:

  • features 7.x-2.0-rc1
  • ctools 7.x-1.2
  • panel 7.x-3.2

Using:

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

Issue summary:View changes

typo/rewording