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

Event hooks when saving a channel or category field?

Developer Preview

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

It looks like the emitter is emitting events when channel field and category fields are added or updated, but there is no hook_id parameter similar to what the ChannelEntry model has. Would it be possible to add hook_ids to those so we can subscribe to the events? Can I use the Event service to subscribe to internal events or is the Event service more for creating and handling events in our own add-ons?

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

So after digging into this it appears pretty easy to make a core model fire event hooks that I can subscribe to. Just adding $_hook_id to the model does the trick. Is this something that could be added to all (or at least the prominent) models?

Attachments don’t appear to be working :( See screenshot: https://www.dropbox.com/s/adx3844khb4hvfe/Screenshot 2016-03-23 20.20.42.png?dl=0

       
Derek Jones's avatar
Derek Jones
7,561 posts
9 years ago
Derek Jones's avatar Derek Jones

Image exceeds our max size (dimensions and file size). With third-party services for file sharing being so ubiquitous, we’re content to let someone else handle storage and bandwidth. 😉

FWIW you can use a Markdown image link to display external images inline.

Will ping the team on your request!

       
Wes Baker's avatar
Wes Baker
343 posts
9 years ago
Wes Baker's avatar Wes Baker

We’re thinking of adding hooks almost exactly like ChannelEntry’s hooks: before/after insert/update/save/delete. Would that work for you? We’d rather there be one true way to do these sorts of things and extension hooks feel like the right way.

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

Yeah, that would be great to have those available on all/the majority of the core models.

       
Wes Baker's avatar
Wes Baker
343 posts
9 years ago
Wes Baker's avatar Wes Baker

Have any models that are a greater priority than others (besides Channel and Category Fields)?

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

Just looking through the Models directory I can see the following benefiting from the hooks:

Ones that would make things easier for me in Publisher: ChannelField CategoryGroup, Template, TemplateGroup, TemplateRoute

Ones that I could see potential in having down the road, but don’t need now. File, MemberField, MemberGroup

       

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.