1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

Issue #1767 - Signup extended user field refinements.

This commit is contained in:
Cameron 2020-04-20 14:00:56 -07:00
parent 31e197ccce
commit 47a1460ac4
2 changed files with 33 additions and 11 deletions

View File

@ -452,7 +452,7 @@ class signup_shortcodes extends e_shortcode
function sc_signup_extended_user_fields()
function sc_signup_extended_user_fields($parm=null)
{
global $usere, $tp, $SIGNUP_EXTENDED_USER_FIELDS, $SIGNUP_EXTENDED_CAT;
$text = "";
@ -501,10 +501,17 @@ class signup_shortcodes extends e_shortcode
$done_heading = true;
}
$label = $tp->toHTML(deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']), false, 'emotes_off,defs');
if(!empty($parm['placeholder']))
{
$parm['placeholder'] = str_replace('[label]', $label, $parm['placeholder']);
}
$replace = array(
$tp->toHTML(deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']), false, 'emotes_off,defs'),
$label,
($ext['user_extended_struct_required'] == 1 ? $this->sc_signup_is_mandatory('true') : ''),
$usere->user_extended_edit($ext, $_POST['ue']['user_' . $ext['user_extended_struct_name']])
$usere->renderElement($ext, $_POST['ue']['user_' . $ext['user_extended_struct_name']], $parm)
);
$text .= str_replace($search, $replace, $SIGNUP_EXTENDED_USER_FIELDS);

View File

@ -871,11 +871,12 @@ class e107_user_extended
/**
* @param $struct
* @param $curval
* @param array $struct
* @param mixed $curval
* @param array $opts
* @return array|string
*/
function renderElement($struct, $curval)
public function renderElement($struct, $curval, $opts=array())
{
$tp = e107::getParser();
$frm = e107::getForm();
@ -901,7 +902,8 @@ class e107_user_extended
$fid = $frm->name2id($fname);
$placeholder = (!empty($parms[4])) ? "placeholder=\"".$tp->toAttribute($parms[4])."\"" : "";
$class = "form-control tbox";
$class = !empty($opts['class']) ? $opts['class'] : "form-control tbox";
$placeholder = !empty($opts['placeholder']) ? "placeholder=\"".$tp->toAttribute($opts['placeholder'])."\"" : $placeholder;
if(!empty($parms[5]))
{
@ -924,7 +926,7 @@ class e107_user_extended
{
case EUF_COUNTRY:
return e107::getForm()->country($fname,$curval);
return e107::getForm()->country($fname,$curval, $opts);
break;
@ -960,7 +962,7 @@ class e107_user_extended
if(deftrue('BOOTSTRAP'))
{
$ret .= $frm->radio($fname,$val,($curval == $val),array('label'=>$label, 'required'=> $struct['user_extended_struct_required']));
$ret .= $frm->radio($fname,$val,($curval == $val),array('label'=>$label, 'required'=> !empty($required)));
}
else
{
@ -1075,10 +1077,23 @@ class e107_user_extended
if(THEME_LEGACY === true)
{
return e107::getForm()->text($fname,$curval,10,array('placeholder'=>'yyyy-mm-dd'));
if(empty($opts['placeholder']))
{
$opts['placeholder'] = 'yyyy-mm-dd';
}
return e107::getForm()->text($fname,$curval,10,$opts);
}
return e107::getForm()->datepicker($fname,$curval,array('format'=>'yyyy-mm-dd','return'=>'string'));
$opts['format'] = 'yyyy-mm-dd';
$opts['return'] = 'string';
if(!empty($required))
{
$opts['required'] = true;
}
return e107::getForm()->datepicker($fname,$curval,$opts);
break;
case EUF_LANGUAGE : // language