Problem/Motivation
When using preview in combination with creating a new node the $entity->in_preview property set in the prepareEntity method of PreviewHandler persists when saving the node and can throw off any custom conditional logic that depends on it.
Steps to reproduce
Prerequisite: add a debug print or use xdebug to inspect the entity in e.g. your Elasticearch normalizer.
- Fill out a node form that's configured for previewing
- Use preview - the debug print indicates that
$entity->in_preview == TRUEas expected - Save the node - the debug print still indicates that we're in preview mode
Proposed resolution
Change $entity->in_preview to $entity->_in_preview so it's transient and doesn't persist through serialization.
Issue fork elasticsearch_helper_preview-3558999
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
artis.bajars commented