Problem/Motivation

Panels (7.x-3.x-dev) throws error notices when choosing a region style. This can be reproduced by creating a panel/mini-panel, then choose a region style and save. There are about 20 error notices like:

Notice: Undefined property: stdClass::$type in panels_renderer_standard->prepare_panes() (line 237 of /bla/bla/sites/all/modules/contrib/panels/plugins/display_renderers/panels_renderer_standard.class.php).
Notice: Undefined property: stdClass::$subtype in panels_renderer_standard->prepare_panes() (line 237 of /bla/bla/sites/all/modules/contrib/panels/plugins/display_renderers/panels_renderer_standard.class.php).

I traced the issue that introduces the patch after which this issue starts: #1797298: Form caching cause references to break, preventing save of stylizer settings forms

The following lines in panels_renderer_editor.class.php are what start causing this:

<?php
   
// Copy settings from form state back into the cache.
   
if(!empty($form_state['values']['settings'])) {
     
$this->cache->display->content[$pid]->style['settings'] = $form_state['values']['settings'];
    }
?>

I think this was added to fix a problem in Panopoly (#1734772: Preview Widget on panels_edit_style_settings_form).

Proposed resolution

I think the issue #1797298: Form caching cause references to break, preventing save of stylizer settings forms is only relevant for panes, not regions. Therefore I suggest checking if the $type is actually a pane and not something else:

<?php
if(!empty($form_state['values']['settings']) && $type == 'pane') {
?>

I'll attach a patch.

Remaining tasks

This needs to be verified, perhaps also with the Panopoly people.

#1797298: Form caching cause references to break, preventing save of stylizer settings forms
#1734772: Preview Widget on panels_edit_style_settings_form

Files: 
CommentFileSizeAuthor
#3 undefined_property_notices_fix-2098515-2.patch727 bytesOnkelTem
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#1 undefined_property_notices_fix-2098515-1.patch681 bytesdagomar
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Comments

StatusFileSize
new681 bytes
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

I faced this problem too.

I too have reached the same code point but I was not sure how this should be fixed properly.

The way it is suggested by the patch provided, we skip setting settings cache for the region. However, I don't know do we need it really. So I've come up to a bit more timid patch. Attaching.

Issue summary:View changes
StatusFileSize
new727 bytes
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Verified the issue in fresh D7.26, ctools 1.4, and Panels 3.4. Both patches worked for me, though I'm not sure which is the better approach.

*bump*bump* needs review by maintainer to choose the better patch.

Status:Needs review» Reviewed & tested by the community

Ok, lets see what japerry says.

I only tried patch #3 since it operates on the base class and is likely to catch more cases. In any case, it works fine.