create static method etemplate_widget_menupopup::fix_encoded_options(), so apps can call that for cases it is not called automatically (eg. autorepeated rows)

This commit is contained in:
Ralf Becker 2013-04-28 12:39:58 +00:00
parent e589930fd8
commit 26c66d12d7

View File

@ -157,17 +157,7 @@ class etemplate_widget_menupopup extends etemplate_widget
$options = (self::$request->sel_options[$form_name] ? $form_name : $this->id);
if(is_array(self::$request->sel_options[$options]))
{
foreach(self::$request->sel_options[$options] as &$label)
{
if(!is_array($label))
{
$label = html_entity_decode($label, ENT_NOQUOTES,'utf-8');
}
elseif($label['label'])
{
$label['label'] = html_entity_decode($label['label'], ENT_NOQUOTES,'utf-8');
}
}
self::fix_encoded_options(self::$request->sel_options[$options]);
// Turn on search, if there's a lot of rows
if(count(self::$request->sel_options[$options]) >= self::SEARCH_ROW_LIMIT)
@ -177,6 +167,27 @@ class etemplate_widget_menupopup extends etemplate_widget
}
}
/**
* Fix already html-encoded options, eg. "&nbps"
*
* @param array $options
*/
public static function fix_encoded_options(array &$options)
{
foreach($options as &$label)
{
// optgroup or values for keys "label" and "title"
if(is_array($label))
{
self::fix_encoded_options($label);
}
else
{
$label = html_entity_decode($label, ENT_NOQUOTES, 'utf-8');
}
}
}
/**
* Get options from $sel_options array for a given selectbox name
*