cclaerhout
Well-known member
The easiest way is of course to create options in the xen options section, but how can I do it when I create options outside this section? In others words, my goal is to get my datas by using the following command:
In my addon, I've got my model and my controlleradmin files.
In my model, I've added a regenerate cache options like this one:
And in my controller admin save function, I've added a callback to the above rebuildMyAddonCache function. It's working but of course if I go back to the XenForo Options section and save one option, my datas won't be there. I would need to modify the XenForo_Model_Option::rebuildOptionCache(), but it's a model, so no listener there.
I might have this solution too, try to get my datas doing this:
Which means to create a new application and implies to modify XenForo_Application::loadDefaultData() which may be, I'm not sure, can be listened with the init_dependencies listener.
Does someone have a solution? Is there an easy way to extend cached datas in options or do I have to do it another way?
Code:
$options = XenForo_Application::get('options');
In my addon, I've got my model and my controlleradmin files.
In my model, I've added a regenerate cache options like this one:
Code:
public function rebuildMyAddonCache()
{
$xenoptions = $this->_getDataRegistryModel()->get('options');
if (!is_array($xenoptions))
{
$xenoptions = $this->rebuildOptionCache();
}
$myaddonoptions['Addon'] = $this->getAllMyAddonDatas();
$mergedoptions = array_merge($xenoptions, $markitupoptions);
$this->_getDataRegistryModel()->set('options', $mergedoptions);
return $myaddonoptions;
}
And in my controller admin save function, I've added a callback to the above rebuildMyAddonCache function. It's working but of course if I go back to the XenForo Options section and save one option, my datas won't be there. I would need to modify the XenForo_Model_Option::rebuildOptionCache(), but it's a model, so no listener there.
I might have this solution too, try to get my datas doing this:
Code:
$options = XenForo_Application::get('customized');
Does someone have a solution? Is there an easy way to extend cached datas in options or do I have to do it another way?