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:
// 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:
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.
Related Issues
#1797298: Form caching cause references to break, preventing save of stylizer settings forms
#1734772: Preview Widget on panels_edit_style_settings_form
Comment | File | Size | Author |
---|---|---|---|
#7 | undefined_property_notices_fix-2098515-7.patch | 939 bytes | niko- |
#3 | undefined_property_notices_fix-2098515-2.patch | 727 bytes | OnkelTem |
#1 | undefined_property_notices_fix-2098515-1.patch | 681 bytes | dagomar |
Comments
Comment #1
dagomar CreditAttribution: dagomar commentedComment #2
OnkelTem CreditAttribution: OnkelTem commentedI 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.
Comment #3
OnkelTem CreditAttribution: OnkelTem commentedComment #4
hawkeye.twolfVerified 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.
Comment #5
DamienMcKennaOk, lets see what japerry says.
Comment #6
ergophobe CreditAttribution: ergophobe commentedI only tried patch #3 since it operates on the base class and is likely to catch more cases. In any case, it works fine.
Comment #7
niko- CreditAttribution: niko- commentedPatches above not really fix this issue.
While I debug it I found that pane and region settings must be saved in different properties of display object.
For pane settings:
For region settings:
But original code saves pane and region settings in the location for panes settings (So warnings apeare).
Moreover this trouble leads to the fact that any custom settings for region will not be saved.
Also possibly other settings forms fall into this issue.
Attached patch fixes this issue such way as I described.
Comment #8
andypostawesome catch!
Comment #10
japerryYup, this tested out good for me, committed patch #7.
Comment #12
Mugé CreditAttribution: Mugé commentedThank you!
Comment #13
maxplus CreditAttribution: maxplus commentedThanks!
notices disappeared after using the current dev version (including this patch)
Comment #14
JeroenKool CreditAttribution: JeroenKool commentedThanks!
Comment #15
ergophobe CreditAttribution: ergophobe commentedI just tried the current dev which includes patch #7 and I'm still getting these errors.
Patch #3 fixed it for me, but #7 doesn't.
I'm running CTools 1.6 RC1 and the current dev version of Panlizer and Panels
Comment #16
ergophobe CreditAttribution: ergophobe commentedSorry for the noise - my bad
Comment #17
ergophobe CreditAttribution: ergophobe commented