We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How can I tell if after_channel_entry_save is called by the bulk/sequential edit?

Developer Preview

Brian Litzinger's avatar
Brian Litzinger
693 posts
6 years ago
Brian Litzinger's avatar Brian Litzinger

I need to know if an entry is being saved via the bulk edit or the sequential edit actions, but I looked through the POST array and the data provided by the after_channel_entry_save hook and didn’t see anything to tell me what action was calling the hook.

In Publisher, if the user is editing a non-default language in the normal publish page, it sets the language in the CP to that non-default language, so the next time they edit an entry they immediately get the same language. However, if they then go to the edit entry list page and try to perform some bulk actions the language is still set to the non-default language, which then causes the bulk actions to potentially mess up data b/c its saving the default language (what the bulk edit forms default to, which is fine) over top of the non-default b/c Publisher’s cookie is still set to the non-default language.

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
6 years ago
Kevin Cupp's avatar Kevin Cupp

It’s not great, but you might have to look at the URI/query string. Bulk edit should be triggering the save by hitting /cp/publish/bulk-edit/save and sequential edit should have entry_ids and modal_form=y in the query string. I doubt these things would change any time soon. Otherwise, the hook is neatly abstracted to the model which doesn’t know anything about the UI, so it’s difficult and also kind of undesirable to pass UI state through to that level currently.

       
Brian Litzinger's avatar
Brian Litzinger
693 posts
6 years ago
Brian Litzinger's avatar Brian Litzinger

That makes sense and about what I was expecting after inspecting the hook. I can make it work, thanks!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.