$string['profilefieldtypetext'] = 'Text input';
$string['profilefieldtypetextarea'] = 'Text area';
$string['profilefieldmaxlength'] = 'Maximum length';
+$string['profilefieldispassword'] = 'Is this a password field?';
$string['profileforceunique'] = 'Should the data be unique?';
$string['profileinvaliddata'] = 'Invalid value';
$string['profilelocked'] = 'Is this field locked?';
$form->addElement('text', 'param2', get_string('profilefieldmaxlength', 'admin'), 'size="6"');
$form->setDefault('param2', 2048);
$form->setType('param2', PARAM_INT);
+
+ /// Param 3 for text type detemines if this is a password field or not
+ $form->addElement('selectyesno', 'param3', get_string('profilefieldispassword', 'admin'));
+ $form->setDefault('param3', 0); // defaults to 'no'
+ $form->setType('param3', PARAM_INT);
}
}
-?>
\ No newline at end of file
+?>
function edit_field_add(&$mform) {
$size = $this->field->param1;
$maxlength = $this->field->param2;
+ $fieldtype = ($this->field->param3 == 1 ? 'password' : 'text');
/// Create the form field
- $mform->addElement('text', $this->inputname, format_string($this->field->name), 'maxlength="'.$maxlength.'" size="'.$size.'" ');
+ $mform->addElement($fieldtype, $this->inputname, format_string($this->field->name), 'maxlength="'.$maxlength.'" size="'.$size.'" ');
$mform->setType($this->inputname, PARAM_MULTILANG);
}