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

Actions or Hooks?

Development and Programming

mweichert's avatar
mweichert
68 posts
17 years ago
mweichert's avatar mweichert

Hi,

I was hoping that someone might help me understand the difference between actions and hooks. I’m developing a module for Sphinx, a full-text search engine (http://ellislab.com/forums/viewthread/85055/).

I need two things:

1) An action/hook that gets executed any time that a field group or field is added or modified 2) A control panel option to manually trigger the action/hook.

Thanks, Mike

       
Brian M.'s avatar
Brian M.
529 posts
17 years ago
Brian M.'s avatar Brian M.

Both of those should work fine. You need to find an appropriate hook for #1 (it should exist), because you’re looking for changes that happen through interaction with the control panel (although it can also fire off through interaction from the front end if you choose the right hook). #2 sounds like it will be an action that you develop within your module.

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
17 years ago
Leevi Graham's avatar Leevi Graham

From my experience actions are generally used in modules for grabbing form post data on the client and admin side.

Sounds like you’ll need to use hooks when a user creates a new custom field.

       
mweichert's avatar
mweichert
68 posts
17 years ago
mweichert's avatar mweichert

Okay, I think I’m getting the hang of things better. Thanks for the reply guys. I spent some time looking Mark Huot’s implementation of the Checkboxes plugin. I see that he implemented an extension for the show_full_control_panel_end hook.

Now, just to be sure I’m understanding things correctly, that hook in particular gets called everytime a form finishes rendering and C=admin is included in the URL. It’s used to do search/replace stuff with the HTML (passed in as $out).

I suppose things could break if the regex patterns weren’t speciifc enough, otherwise you could have your extension modifiying the output of pages that it wasn’t intended for.

Am I getting it?

Thanks again, Mike

       
Brian M.'s avatar
Brian M.
529 posts
17 years ago
Brian M.'s avatar Brian M.

You’re in!

Let us know how you development pans out. Are you planning on releasing this for public consumption?

       
mweichert's avatar
mweichert
68 posts
17 years ago
mweichert's avatar mweichert

Thanks Brian. Yes, we’ll be releasing anything that could be used by others.. though I might have to clean up some thing. 😊

Cheers, Mike

       

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.