Resave newly fetched version of element in EVENT_AFTER_SAVE_ELEMENT #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Further fixes for #64 and potentially also #62
The fix @brandonkelly submitted here worked for elements that already existed, but some funky behaviour stripping matrix fields still occurred the first time an element was created.
This PR attempts to fix that, by ensuring that the element being resaved in the
EVENT_AFTER_SAVE_ELEMENT
is a freshly fetched version of itself, rather than the version of the element that was passed through the event. This way, matrix references appear to correctly match up and thus are correctly saved alongside the preparse data that is generated.Also some minor formatting occurred, sorry that the diff is a little difficult to follow.