allow "settings" hook to return the settings, instead of passing it via a global variable (depricated now)

This commit is contained in:
Ralf Becker 2009-04-29 06:26:58 +00:00
parent b72236a663
commit af286333bf

View File

@ -66,17 +66,27 @@
{
$this->appname = $appname;
$GLOBALS['egw']->translation->add_app($this->appname);
translation::add_app($this->appname);
if($this->appname != 'preferences')
{
$GLOBALS['egw']->translation->add_app('preferences'); // we need the prefs translations too
translation::add_app('preferences'); // we need the prefs translations too
}
if(!$GLOBALS['egw']->hooks->single('settings',$this->appname))
// calling the settings hook
$settings = $GLOBALS['egw']->hooks->single('settings',$this->appname);
// it either returns the settings or save it in $GLOBALS['settings'] (deprecated!)
if (isset($settings) && is_array($settings) && $settings)
{
return False;
$this->settings = array_merge($this->settings,$settings);
}
elseif(isset($GLOBALS['settings']) && is_array($GLOBALS['settings']) && $GLOBALS['settings'])
{
$this->settings = array_merge($this->settings,$GLOBALS['settings']);
}
else
{
return False; // no settings returned
}
$this->settings = array_merge($this->settings,$GLOBALS['settings']);
/* Remove ui-only settings */
if($this->xmlrpc)