If the "Default panel" selector is changed on an entity/bundle, there's no way to automatically update existing entity objects to use the new default, they'll all still use the old one. Need to add an option on the display to update existing records if the values are changed.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | panelizer-n2332997-7.patch | 9.4 KB | damienmckenna |
Comments
Comment #1
damienmckennaThis appears to work, though the node caches are not cleared afterwards.
Comment #2
damienmckennaThis version checks if EntityCache is enabled, if so it'll clear the caches for this entity type. It's a little heavy-handed, but I don't know if there's a reliable way of clearing caches for only objects of the specific entity bundle.
Comment #3
damienmckennaThis resolves problems if the $old_value was unset.
Comment #4
damienmckennaNeeds to be added to the main Panelizer settings page too.
Comment #5
saltednutI am seeing the checkbox to update under
/admin/structure/types/manage/[bundle]but when I save the node settings form I see the following error.Notice: Undefined variable: old_bundle in PanelizerEntityDefault->add_bundle_setting_form_submit() (line 822 of /modules/contrib/panelizer/plugins/entity/PanelizerEntityDefault.class.php).It looks like you are trying to use a variable called
$old_bundlethat does not exist.In addition, when I go to the panelizer settings, I do not see this option. But it is another place where I could change this setting.
Comment #6
damienmckennaThis version works without the errors.
Comment #7
damienmckennaThis version adds the same link & necessary logic on the main settings page.
Comment #8
saltednutJust tested this inside the 'WEM Demo' of Demo Framework.
Scenario 1:
/admin/structure/types/manage/wem-newspageScenario 2:
/admin/config/content/panelizerpageThis works for me, but I did find one edge case:
Repeat steps above in either scenario, but leave out step 5 (checking the checkbox). This updates the default display only for new entities (works as designed). However, if I had forgotten to check the checkbox, but I wanted this change to be enacted, I wouldn't be able to just check it now and save. Nothing would happen, per "Note: only takes effect when the display is changed, and will not work if the default was not assigned previously."
I can work around this by changing the display back to the previous version, then click save (no checkbox needed). I'm then back to a state where I could run through the workflow again, changing the default panel and this time and remembering to check the checkbox.
In short: It might be nice to allow people to check the checkbox later on in time or if they forgot to check it.
Comment #9
damienmckennaI don't think there'd be a good way of expanding the current logic without running into a ton of problems. Also, once I work out the necessary #states logic I'm planning on hiding the new checkboxes until the selector is actually changed.
I'm intending to have full (working) VBO support soon, and a default admin page where people could manage that, and when that's working I'll add a link (with appropriate permission checks) in the Panelizer settings forms.
Comment #10
saltednutOk. That makes sense. We can post followups for that feature.
Comment #11
damienmckennaThanks for the help reviewing it, Brant.
Committed.