On hook_entity_load(), CPS takes care of swapping in the correct revision of an entity based on the changeset that was active when the entity was loaded.
However, if your code is working with that entity later on, there does not appear to be any easy way to figure out which changeset it was loaded for.
This patch adds a property to the entity which tells you that information. I'm finding it useful for some code I have that wants to examine the loaded entity and then load other entities that are referenced by it, while ensuring that those child entities are loaded using the same changeset that the parent entity was loaded with.
Comments
Comment #2
David_Rothstein commentedHere is a patch.
Since this requires running a bit more code in hook_entity_load() in the case where the live changeset is being viewed (i.e. for non-site-administrators) than ran before, this also includes a small performance improvement to some of that code, in particular the code that checks with Drafty whether a revision was requested.
Comment #4
hadsie commented