1

I've got a plugin that does a thing when an entry is resaved. It works great. However I need it to fire for every single entry to build some data.

craft()->on('entries.saveEntry', function(Event $event) {
    // Do the thing
});

Why does running a ResaveElements task not fire this yet saving an entry does? Updating a section to cause all of the entries in that section to update doesn't either.

Is there a way I can bulk trigger this to fire outside of me having to write my own script to manually do it.

Thanks!

1 Answer 1

2

It's because the ResaveElements task calls craft()->elements->saveElement() directly, instead of going through the element specific save method (like craft()->entries->saveEntry().

You'll want to listen to the onSaveElement event, check that it's an Entry you're looking at, then perform any specific business logic that you need.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.