Currently, the Panelizer field contains either (a) the name of a default, or (b) a Panels display (for a custom override). This is exactly how it worked in D7.

However, this caused a number of interesting problems in D7, for example:

  1. You create a node, which uses the default
  2. Later, you edit it to use a custom override
  3. Then you change the default
  4. When viewing the old revision when it was on the default, you're NOT shown what it used to look like on that old revision! Instead, you're being shown what the node would look like if you reverted it to default.

This problem would be solved if we kept a copy of the default Panels display on the field. The 'default' property would signal to us that this is a default, rather than a custom override.

Then when a default is updated, we could (optionally! - the user should be able to opt in/out of this) update the current (but not older) revision to make it use the latest version of the default.

This will give the user way more control, and allow better integration with workflow tools like Workbench Moderation.

Comments

dsnopek created an issue. See original summary.

phenaproxima’s picture

Will this approach scale? What if you have hundreds of thousands of panelized nodes (of a single type), and their default layout is changed? Will that require updating every single one of those nodes? If so, this could perhaps be smoothed over using the Batch API...

damienmckenna’s picture

In D7 it's a performance problem, there should be a way of keeping only one copy of a default in memory at a time.

dsnopek’s picture

Re #2: We'll need to figure that :-) We could do it out-of-band, like with the Batch API or even during cron, if necessary. Or if we don't care about entity hooks running, it'd be like a single SQL statement.

Re #3: I'm not sure what you mean. In D7, is it actually loading several Panels displays into memory at once? In any case, the intention is that the displays would only be duplicated on disk in the database (and storage is cheap!), but we'd still only load a single Panels display into memory at once!

dsnopek’s picture

Issue summary: View changes
damienmckenna’s picture

@dsnopek: The problem in D7 is that you have a full Panelizer object attached to an entity during entity_load().. and then load 100 entities to display the homepage of a complex site...

dsnopek’s picture

Ah, ok, that makes sense, thanks!

In the D8 version, the field only loads the serialized array. We don't convert it into an actual PanelsDisplayVariant until rendering the entity. And with all the render caching that happens in Drupal 8 we hopefully won't be fully rendering them very often. But we'll need to experiment and benchmark to make sure it isn't a problem.