Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resave newly fetched version of element in EVENT_AFTER_SAVE_ELEMENT #66

Merged
merged 1 commit into from
Feb 23, 2021

Conversation

monachilada
Copy link
Contributor

@monachilada monachilada commented Dec 3, 2020

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.

@monachilada
Copy link
Contributor Author

@jalendport @rjhewitt3 Hi folks, happy new year. I was hoping that one of you could take a look at this in the near future, as I have a feeling it could be effecting quite a few people without them really realising it. And more so as adoption of the latest Craft version picks up in January. I'd be very appreciative to hear any feedback. Thanks.

@sjcallender
Copy link

@jalendport - We just ran into a similar issue with this on the Annotated Notes plugins which caused serious content problems for our client. We have this plugin installed and haven't seen this issue popup, but we'd definitely feel much better if this PR could be merged sooner than later. What are you thinking, good sir?

@jakedohm
Copy link

jakedohm commented Feb 5, 2021

@jalendport @monachilada's fork fixed the issue that I was seeing with Neo blocks being destroyed upon re-save 👍

For anyone following this, until this gets merged, you can patch it by using @monachilada's fork by doing the following:

  1. Add the following to composer.json
"repositories": [
  {
    "type": "vcs",
    "url": "https://github.com/monachilada/craft-preparse-field"
  }
],
  1. Update your require reference for craft-preparse-field to use the develop branch from the repository linked above.

Before

"besteadfast/craft-preparse-field": "1.x.x"

After

"besteadfast/craft-preparse-field": "dev-develop"

@jalendport
Copy link
Owner

@monachilada thanks for the PR! Thanks everyone else for your patience; I’ve got some time set aside tomorrow afternoon to test ‘er out and then I’ll merge and cut a new release for y’all.

@sjcallender
Copy link

Hey @jalendport! How'd that testing go? 😉

@jalendport jalendport merged commit 6f8219b into jalendport:develop Feb 23, 2021
@brandonkelly
Copy link
Contributor

Thanks @jalendport! 🎉

@monachilada
Copy link
Contributor Author

Thanks @jalendport

@sjcallender
Copy link

About time! Haha. I mean, thanks @jalendport! 😜

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants