CodeAlfa
CodeAlfa

Reputation: 31

Respond to a change configuration event in joomla

I'm working on a Joomla 2.5 component for a client and we have the ability to change the background color in the component configurations in the back end. This change is made using a color picker so virtually any color can be selected.

Suffice to say without going in too much details, it is pretty process intensive to set all the color changes in the component including finding the appropriate images to load. I want to do this compiling only when the change is made in the component parameters but I'm not seeing anywhere where Joomla fires an event when a configuration is saved by the com_config component and I don't want to change where the client has this option or how it is accessed.

Does any body have any idea how I could respond to this event since making changes to Joomla source code is not an option?

Upvotes: 0

Views: 193

Answers (1)

piotr_cz
piotr_cz

Reputation: 9636

There is a pending patch to include onConfigurationBeforeSave and onConfigurationAfterSave events: #29769.

Until it's merged, the only idea that comes to my mind is observing the components' configuration from component itself.

  1. Load latest known configuration checksum from cache
  2. Compare to current configuration checksum.

    a) If different, store current configuration hash and run processing

Now, there are few places where you may execute it:

  • on every component execution
  • on closing configuration modal box (Joomla 1.5 - 2.5)
  • using cron jobs

Upvotes: 1

Related Questions