mirror of
https://github.com/e107inc/e107.git
synced 2025-08-24 15:13:04 +02:00
tweaked the radio_multi function to handle a string for field-help or an array.
This commit is contained in:
@@ -879,7 +879,15 @@ class e_form
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function radio_multi($name, $elements, $checked, $multi_line = false, $help = array())
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
* @param array $elements = arrays value => label
|
||||||
|
* @param string/integer $checked = current value
|
||||||
|
* @param boolean $multi_line
|
||||||
|
* @param mixed $help array of field help items or string of field-help (to show on all)
|
||||||
|
*/
|
||||||
|
function radio_multi($name, $elements, $checked, $multi_line = false, $help = null)
|
||||||
{
|
{
|
||||||
$text = array();
|
$text = array();
|
||||||
if(is_string($elements)) parse_str($elements, $elements);
|
if(is_string($elements)) parse_str($elements, $elements);
|
||||||
@@ -887,7 +895,8 @@ class e_form
|
|||||||
foreach ($elements as $value => $label)
|
foreach ($elements as $value => $label)
|
||||||
{
|
{
|
||||||
$label = defset($label, $label);
|
$label = defset($label, $label);
|
||||||
$text[] = $this->radio($name, $value, (string) $checked === (string) $value)."".$this->label($label, $name, $value).(isset($help[$value]) ? "<div class='field-help'>".$help[$value]."</div>" : '');
|
$helpLabel = (is_array($help)) ? vartrue($help[$value]) : $help;
|
||||||
|
$text[] = $this->radio($name, $value, (string) $checked === (string) $value)."".$this->label($label, $name, $value).(isset($helpLabel) ? "<div class='field-help'>".$helpLabel."</div>" : '');
|
||||||
}
|
}
|
||||||
if(!$multi_line)
|
if(!$multi_line)
|
||||||
return implode(" ", $text);
|
return implode(" ", $text);
|
||||||
|
Reference in New Issue
Block a user