1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-14 18:44:27 +02:00

Admin-ui: When type='image' and optArray has been set, will render a set selection of inline images.

This commit is contained in:
Cameron
2017-04-08 12:57:21 -07:00
parent 1c77e12454
commit a80e6c52f0
2 changed files with 59 additions and 0 deletions

View File

@@ -5384,6 +5384,14 @@ class e_form
case 'video':
case 'image': //TODO - thumb, image list shortcode, js tooltip...
$label = varset($parms['label'], 'LAN_EDIT');
if(!empty($parms['optArray']))
{
return $this->imageradio($key,$value,$parms);
}
unset($parms['label']);
if($attributes['type'] === 'video')
@@ -5392,6 +5400,7 @@ class e_form
$parms['w'] = 280;
}
$ret = $this->imagepicker($key, $value, defset($label, $label), $parms);
break;
@@ -5733,6 +5742,46 @@ class e_form
return $ret;
}
private function imageradio($name,$value,$parms)
{
if(!empty($parms['path']))
{
$parms['legacy'] = $parms['path'];
}
$text = '<div class="clearfix">';
foreach($parms['optArray'] as $key=>$val)
{
$thumbnail = e107::getParser()->toImage($val,$parms);
// $thumbnail = "<img class='img-responsive img-fluid thumbnail' src='".$preview ."' alt='".$val."' />";
$selected = ($val == $value) ? " checked" : "";
$text .= "
<div class='col-md-2 e-image-radio' >
<label class='theme-selection' title=\"".$key."\"><input type='radio' name='".$name."' value='{$val}' required='required' $selected />
<div>".$thumbnail."</div>
</label>
</div>";
}
$text .= "</div>";
return $text;
}
/**
* Generic List Form, used internally by admin UI
* Expected options array format: