Actual version: 7.x-2.0+17-dev

This is part of the Panopoly distribution

Enabled blog module
Go to admin/config/content/panelizer
Set blog to "panelize" and "allow panel choice"
enable the blog user view in /admin/structure/pages
Attempt to create a blog post.
Watch as it throws up all over itself with these notices:
Warning: Attempt to assign property of non-object in PanelizerEntityDefault->hook_entity_insert() (line 775 of /var/www/esmerel/panopolynodemo/profiles/panopoly/modules/contrib/panelizer/plugins/entity/PanelizerEntityDefault.class.php).
Warning: Attempt to assign property of non-object in PanelizerEntityDefault->hook_entity_insert() (line 776 of /var/www/esmerel/panopolynodemo/profiles/panopoly/modules/contrib/panelizer/plugins/entity/PanelizerEntityDefault.class.php).
Warning: Attempt to assign property of non-object in PanelizerEntityDefault->hook_entity_insert() (line 777 of /var/www/esmerel/panopolynodemo/profiles/panopoly/modules/contrib/panelizer/plugins/entity/PanelizerEntityDefault.class.php).
Warning: Attempt to assign property of non-object in PanelizerEntityDefault->hook_entity_insert() (line 780 of /var/www/esmerel/panopolynodemo/profiles/panopoly/modules/contrib/panelizer/plugins/entity/PanelizerEntityDefault.class.php).
PDOException: SQLSTATE[HY000]: General error: 1364 Field 'entity_type' doesn't have a default value: INSERT INTO {panelizer_entity} (name) VALUES (:db_insert_placeholder_0); Array ( [:db_insert_placeholder_0] => ) in drupal_write_record() (line 7013 of /var/www/esmerel/panopolynodemo/includes/common.inc).

Go back to admin/config/content/panelizer/node/blog/list and add a panel configuration.
Everything works perfectly.

Now, if you disable that panel configuration, everything dies again.
Also, if you there's no configuration created under /node/blog/list, on the create content page under "Panelizer" it will say "not panelized" and there are no choices in the 'panel' dropdown.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

esmerel’s picture

Title: Multiple errors when attempting to save content when 'no default' is checked. » Multiple errors when attempting to save content when "provide panel default" is not checked.

Updating title, because hey, having a title that makes sense is good.

esmerel’s picture

Status: Active » Fixed

Tried this out with beta 4. It looks like view modes reworked whatever was causing this, because it's not happening now.

Status: Fixed » Closed (fixed)

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

adamdicarlo’s picture

Warning: Attempt to assign property of non-object in PanelizerEntityDefault->hook_entity_update() (line 844 of /.../modules/contrib/panelizer/plugins/entity/PanelizerEntityDefault.class.php).
Warning: Attempt to assign property of non-object in PanelizerEntityDefault->hook_entity_update() (line 845 of /.../modules/contrib/panelizer/plugins/entity/PanelizerEntityDefault.class.php).
Warning: Attempt to assign property of non-object in PanelizerEntityDefault->hook_entity_update() (line 848 of /.../modules/contrib/panelizer/plugins/entity/PanelizerEntityDefault.class.php).
Notice: Undefined index: backtrace in _drupal_log_error() (line 207 of includes/errors.inc).
PDOException: SQLSTATE[HY000]: General error: 1364 Field 'entity_type' doesn't have a default value: INSERT INTO {panelizer_entity} (name, no_blocks, css_id, css, pipeline, contexts, relationships, did) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => node:document:default [:db_insert_placeholder_1] => 0 [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => ipe [:db_insert_placeholder_5] => a:0:{} [:db_insert_placeholder_6] => a:0:{} [:db_insert_placeholder_7] => 0 ) in drupal_write_record() (line 7020 of includes/common.inc).

I'm getting this whenever I try to save the Panelizer configuration page (admin/config/content/panelizer) or even when I try to do a feature export/recreate through Drush. Even if it's not for a feature with any panelizer configuration exported.

This started quite soon after turning off the "Provide default"Allow panel choice option on all of my panelized content types.

Versions:

; Latest: 7.x-2.0 + 19 commits.
projects[panelizer][subdir] = "contrib"
projects[panelizer][revision] = "daec7d23cedced68730dcfe2a869955076afd683"

; Latest: 7.x-3.2 + 5 commits.
projects[panels][subdir] = "contrib"
projects[panels][revision] = "9c467adba1348560925a30bf52d9eb825b30988b"
adamdicarlo’s picture

Status: Closed (fixed) » Active

Just realized OP was panelizing Blog nodes and I'm panelizing Poll nodes. Both content types implemented by core with hook_node_info(). Coincidence?

adamdicarlo’s picture

This doesn't happen when I turn off the UUID module. (I'm not using Panopoly but I am/was using UUID & Deploy.)

In fact, the function in Panelizer that's crashing (PanelizerEntityDefault::hook_entity_update()) doesn't even get called when saving this form when UUID's turned off. (uh... whah?)

When UUID *is* on, $entity->panelizer is an array rather than an object and looks to me like it's missing a bunch of data.

merlinofchaos’s picture

Hm. I wonder if UUID is calling entity_save() with a fake entity. If that's the case, that could make panelizer *very* unhappy.

Sergii’s picture

Status: Active » Needs review
FileSize
2.89 KB

The problem was it the way uuid stores data: Panelizer and Ctools display objectes become an array.
I created the integration between Panelizer and UUID export to features functionality.

merlinofchaos’s picture

Wow, is that really the right way to do this? This seems completely insane to me. :(

adamdicarlo’s picture

Wondering if I'm following merlin's train of thought and what's going on here. I take it:

  • Panelizer needs to implement UUID hooks in order to work correctly when panelized entities get exported (this seems reasonable)
  • If Panelizer doesn't implement UUID hooks at all, UUID corrupts panelized entities' ::panelizer object for some reason (insane)
  • UUID causes panelized entity/entities to get saved when Panelizer config form is saved for some reason (insane)

I'll admit I'm pretty baffled now -- how was I able to export the panelized nodes in the first place...?

DamienMcKenna’s picture

Issue summary: View changes
Status: Needs review » Needs work

This needs to be rerolled for v3.

DamienMcKenna’s picture

Title: Multiple errors when attempting to save content when "provide panel default" is not checked. » Multiple errors when attempting to save content when "provide panel default" is not checked
Version: 7.x-2.x-dev » 7.x-3.x-dev
DamienMcKenna’s picture

mukhsim’s picture

mukhsim’s picture

DamienMcKenna’s picture

I was able to reproduce the problem when UUID was disabled (it was enabled first, the error shows, then I disabled UUID, reran test).

In my scenario the error happens when saving a (gallery_photo) node that was added to another (gallery) node via inline_entity_form, and the Panelizer options were not displayed on the form (#2163045: Add integration for inline_entity_form). Furthermore, in this case there were two view modes configured for the gallery_photo content type - page_manager and a custom view mode called "gallery_item". When hook_entity_insert() is triggered in PanelizerEntityDefault and runs the for() loop, the first view mode has a proper $panelizer object, the second view mode just contains the name of the selected panelizer display, not a Panelizer object.

I'll continue on this later.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
1023 bytes

What I realized was that, in certain circumstances, the hook_field_attach_submit() call wasn't happening before hook_entity_save(), so the $panelizer values in the hook_entity_save() foreach() loop ended up being arrays with the 'name' value, so I changed it to load the Panelizer object instead.

This could use some testing, but it seems to have resolved the problem for my use case.

DamienMcKenna’s picture

FileSize
1.05 KB

Small improvement for the if() statement.

DamienMcKenna’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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

MiroslavBanov’s picture

Title: Multiple errors when attempting to save content when "provide panel default" is not checked » Multiple errors when attempting to save content when "Allow panel choice" is checked
Status: Closed (fixed) » Active
Related issues: +#2192355: Undefined panels display::UUID in i18n_panels periodic error
FileSize
23.66 KB

This still happens for me, when I use i18n_panels + panelizer and I configure "Panelizer: Allow panel choice" to be on. This happens even if there is only one panel choice - the "default".
When I delete a node, I get one error and one warning (see attached image):
:$uuid in _18n_panels_fetch_all_panel_displays() (line 420 of .../sites/all/modules/contrib/panels/i18n_panels/i18n_panels.module). Warning message The reverted panels display(s) were exported, please run a string refresh to update the translatable strings.

Error message
Notice: Undefined property: panels_display::$uuid in _18n_panels_fetch_all_panel_displays() (line 420 of .../sites/all/modules/contrib/panels/i18n_panels/i18n_panels.module).
Warning message
The reverted panels display(s) were exported, please run a string refresh to update the translatable strings.

I tried the latest versions of panelizer and panels, still getting the error.

Panelizer, latest 3.x :
commit e68d0033d674c4e42e82e1d87bcfc7a8b202b91c
Author: Damien McKenna <...>
Date:   Tue Apr 1 10:51:27 2014 -0400
    Issue #2223479 by DamienMcKenna: Expanded entity_allows_revisions() to separate whether revisions are supported and whether they're enabled by default.

Panels, latest 3.x :
commit 8059bda2bfe84eb881316b04208f152411e611a3
Author: Jakob Perry <...>
Date:   Mon Mar 3 14:23:51 2014 -0800
    Issue #2188277 by japerry: add checks around panels_cache table when updating panels from 3.3
DamienMcKenna’s picture

Status: Active » Closed (fixed)

It seems like this problem is entirely because of #2192355: Undefined panels display::UUID in i18n_panels periodic error. Did you try the patch from that issue?

MiroslavBanov’s picture

Status: Closed (fixed) » Active

I did apply the patch. It is not fixing the other issue that with the

Warning message
The reverted panels display(s) were exported, please run a string refresh to update the translatable strings.

I thought this was caused by some a more fundamental problem. I notice that the same issue happens when there is no "Allow panel choice", and the panelizer in Default state. On node updete a panelizer_entity is written to the database, even though the panelizer is still in Default state. Then on node delete, I see the warning.

I think the real problem is that a panelizer_entity is being created, even though the node Panelizer is in Default state. Please correct me, if I am wrong.

MiroslavBanov’s picture

Status: Active » Needs review
FileSize
724 bytes

I think I understand the problem I had. When the panelized node in Default state is deleted, in PanelizerEntityDefault::delete_entity_panelizer,
SELECT did FROM {panelizer_entity}
returns '0', then panels_delete_display(0) causes both errors. Adding an array_filter removes the zeros.

DamienMcKenna’s picture

Status: Needs review » Closed (fixed)

Because this new bug has nothing to do with the original request, I've moved it into a separate issue: #2235537: Error when deleting a panelized entity

artematem’s picture

Component: User interface » Code
Status: Closed (fixed) » Needs review
FileSize
1.05 KB

Applying same approach as in #18 patch to hook_entity_update to avoid errors like Warning: Attempt to assign property of non-object in PanelizerEntityDefault->hook_entity_update() (...

DamienMcKenna’s picture

Status: Needs review » Fixed

Thanks Artem! The patch has been committed.

Status: Fixed » Closed (fixed)

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