Call function if Admin Option Changes?

alexp999

Active member
Hi,

I am working on an add-on and would like to clear out a cache directory if a setting changes.

I have seen that you can run a validation callback, is it possible to use this to determine if the value has changed?

i.e. I don't want to clear the cache directory everytime someone presses save in the ACP settings, only if this specific settings value has changed.
 
You have access to the $dw object, see XenForo_Option_TemplateFiles for an example.

You can do: $dw->getExisting('option_value') and compare that to $option or simply, $dw->isChanged('option_value');
 
Last edited:
isChanged didn't seem to work, but getExisting did, so I have been able to create an if statement which does what I want.

Thanks for the help. :)
 
Top Bottom