• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: How to attach functionality to hooks ?
PostPosted: Fri Mar 15, 2019 2:04 am 
Offline
Forum Members
Forum Members

Joined: Sun Feb 03, 2008 8:14 pm
Posts: 45
I have a feeling I'm overlooking something obvious - sorry

I read with interest the stuff in some module help re. hooks available and in cmsmadesimple.org/documentation/programming/hooks and events

I've used hooks before and Ive added attached functionality to hooks in other CMSs before. The documentation provides examples of how hooks should be built in to a module; I've seen and understand the section on
Using (sending) Hooks which describes \CMSMS\HookManager::do_hook()


but I can't seem to find anything regarding where to put this hook functionality ?. For instance in another CMS, attaching to a hook is always placed in ready.php or init.php in the root directory the CMS is installed in

TIA


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to attach functionality to hooks ?
PostPosted: Fri Mar 15, 2019 7:58 am 
Offline
Power Poster
Power Poster

Joined: Sun Apr 19, 2009 9:33 am
Posts: 1307
I am not sure if you are intrested in the HookManager as programmer or cmsms enduser?

From a programmers perspective read: ./lib/classes/class.HookManager.php to get a sense on what functionality is available.

There are many CMSMS core modules that implement the HookManager for example News: ./modules/News/action.addcategory.php -> NewsCategoryAdded hook. You can also implement the HookManager into your own module actions.

As enduser have a look at /admin -> Extensions -> Event Manager there you can see some in action.

I have to admit the CMSMS (enduser)documentation on the Event Manager is a bit sparse:
https://docs.cmsmadesimple.org/tags/event-manager

These are extensive:
https://docs.cmsmadesimple.org/advanced ... and-events
https://docs.cmsmadesimple.org/advanced/hooks-reference

_________________
The CMSMS Builder is a tool to help you develop and optimize CMS Made Simple >= 2.2.3 themes, it is made by a developer for developers.

I you like an automated file based work-flow this project might be for you. It is usable to kick-start a new CMSMS project or it can be applied to existing ones.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to attach functionality to hooks ?
PostPosted: Sun Mar 17, 2019 3:47 pm 
Offline
Forum Members
Forum Members

Joined: Sun Feb 03, 2008 8:14 pm
Posts: 45
Thank you for the reply Arnoud

kind of both - it was reading the module help for FEU and the CMSMS Docs section on Hooks & Events that prompted the question. Between those two I wonder if functionality could be added to hooks outside of a Module/ Event - particularly as in these documents the point is made that not all Hooks are Events - i.e. there are Cases which have a have a Hook but no Event

I suppose my use of other CMSs is muddying my understanding (where code snippets (which in CMSMS reside in UDTs and can be triggered via Events), in some other CMSs all hooks can be extended via code snippets added to a particular file in the filesystem (e.g. ready.php etc which is always loaded when the CMS initiates - i.e. outside of the database).

From your reply, with CMSMS hooks are for programmers use within their module; Events are for endusers within their UDTs in Admin. There is no extensibility of hooks outside of a module or UDT

Thanks for the clarification/confirmation Arnoud


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to attach functionality to hooks ?  Topic is solved
PostPosted: Sun Mar 17, 2019 7:34 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Tue Oct 19, 2004 6:44 pm
Posts: 7986
Location: Fernie British Columbia, Canada
You can create a UDT to handle an Event.
That UDT CAN (though it is not a smart idea) emit hooks.

Modules can emit and handle hooks and events.

In the upcoming version of 2.3 everything will be 'hooks' so simple plugins and modules will be able to handle hooks.

No, there is no recommended simple 'php' file you can extend to inject your own php code, other than a module.

_________________
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: How to attach functionality to hooks ?
PostPosted: Wed Mar 20, 2019 8:15 pm 
Offline
Forum Members
Forum Members

Joined: Sun Feb 03, 2008 8:14 pm
Posts: 45
Thanks for the update - good to know.

And thanks to you and the rest of the dev Team for all your hard work on CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting