mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 04:40:44 +02:00
Allow Ajax API for dropdowns.
This commit is contained in:
@@ -3978,11 +3978,22 @@ class e_form
|
|||||||
*/
|
*/
|
||||||
function renderElement($key, $value, $attributes, $required_data = array(), $id = 0)
|
function renderElement($key, $value, $attributes, $required_data = array(), $id = 0)
|
||||||
{
|
{
|
||||||
// return print_a($value,true);
|
|
||||||
$parms = vartrue($attributes['writeParms'], array());
|
|
||||||
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
$ajaxParms = array();
|
||||||
|
|
||||||
|
if(varset($attributes['writeParms']['ajax']))
|
||||||
|
{
|
||||||
|
$ajaxParms['data-src'] = varset($attributes['writeParms']['ajax']['src']);
|
||||||
|
$ajaxParms['data-target'] = varset($attributes['writeParms']['ajax']['target']);
|
||||||
|
$ajaxParms['data-method'] = varset($attributes['writeParms']['ajax']['method'], 'html');
|
||||||
|
$ajaxParms['data-loading'] = varset($attributes['writeParms']['ajax']['loading'], $tp->toGlyph('fa-spinner', array('spin'=>1)));
|
||||||
|
|
||||||
|
unset($attributes['writeParms']['ajax']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$parms = vartrue($attributes['writeParms'], array());
|
||||||
|
|
||||||
if(is_string($parms)) parse_str($parms, $parms);
|
if(is_string($parms)) parse_str($parms, $parms);
|
||||||
|
|
||||||
if(!empty($attributes['multilan']))
|
if(!empty($attributes['multilan']))
|
||||||
@@ -4303,6 +4314,14 @@ class e_form
|
|||||||
if($attributes['type'] === 'comma') $eloptions['multiple'] = true;
|
if($attributes['type'] === 'comma') $eloptions['multiple'] = true;
|
||||||
unset($parms['__options']);
|
unset($parms['__options']);
|
||||||
if(vartrue($eloptions['multiple']) && !is_array($value)) $value = explode(',', $value);
|
if(vartrue($eloptions['multiple']) && !is_array($value)) $value = explode(',', $value);
|
||||||
|
|
||||||
|
// Allow Ajax API.
|
||||||
|
if(!empty($ajaxParms))
|
||||||
|
{
|
||||||
|
$eloptions = array_merge_recursive($eloptions, $ajaxParms);
|
||||||
|
$eloptions['class'] = 'e-ajax ' . varset($eloptions['class']);
|
||||||
|
}
|
||||||
|
|
||||||
$ret = vartrue($eloptions['pre']).$this->selectbox($key, $parms, $value, $eloptions).vartrue($eloptions['post']);
|
$ret = vartrue($eloptions['pre']).$this->selectbox($key, $parms, $value, $eloptions).vartrue($eloptions['post']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user