Benubird
Benubird

Reputation: 19467

Joomla - how to catch system events

I'm writing a joomla extension that is a component (not a plugin), however I also need to be able to detect when an article is published. I've worked out that I can do this with a plugin that catches the system event onContentChangeState, however I cannot figure out how to catch the event with a component. Any ideas?

I'm aware the easiest solution is to do it as two extension, a plugin and a component, but this is unacceptable. It must be a part of the component.

Upvotes: 1

Views: 498

Answers (1)

Craig
Craig

Reputation: 9330

  1. Responding to events can only be done with a plugin, only plugins can act as observers for trigger events. (To do otherwise would require serious hacking of the core).
  2. A Joomla Component is responsible for the "main content" displayed on a page (front/back end). It does not act as an observer (while outdated the component flow is still similar to this diagram).
  3. The common design and practice is to ship a component with it's own plugin's eg. JCE, Virtuemart, Akeeba and the list goes on...
  4. From Joomla! 1.6 onwards a single Package can include multiple archives each with their own manifest i.e. a component and its related plugins.

The end result is that you can make a single extension that uses one install package for it's multiple elements.

Upvotes: 1

Related Questions