method to translate options incl. optionial title

This commit is contained in:
Ralf Becker 2011-08-21 11:38:01 +00:00
parent e0624ebe89
commit 7916e86880

View File

@ -161,10 +161,7 @@ class etemplate_widget_menupopup extends etemplate_widget
}
if (!$no_lang)
{
foreach($options as $value => &$label)
{
$label = lang($label);
}
$options = self::translateOptions($options);
}
//error_log(__METHOD__."('$name') returning ".array2string($options));
return $options;
@ -566,6 +563,20 @@ class etemplate_widget_menupopup extends etemplate_widget
}
if (!$no_lang)
{
$options = self::translateOptions($options);
}
//error_log(__METHOD__."('$widget_type', '$legacy_options', ...) returning ".array2string($options));
return $options;
}
/**
* Translate options incl. optional title (label is an array with values for keys 'label' and optionally 'title'
*
* @param array $options
* @return $options
*/
public static function translateOptions(array $options)
{
foreach($options as $value => &$label)
{
@ -579,8 +590,6 @@ class etemplate_widget_menupopup extends etemplate_widget
if (isset($label['title'])) $label['title'] = lang($label['title']);
}
}
}
//error_log(__METHOD__."('$widget_type', '$legacy_options', ...) returning ".array2string($options));
return $options;
}