2008-09-29 05:18:23 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* EditableEmailField
|
2009-04-17 04:26:40 +02:00
|
|
|
*
|
2008-09-29 05:18:23 +02:00
|
|
|
* Allow users to define a validating editable email field for a UserDefinedForm
|
2009-04-17 04:26:40 +02:00
|
|
|
*
|
|
|
|
* @package userforms
|
2008-09-29 05:18:23 +02:00
|
|
|
*/
|
2009-12-07 03:04:20 +01:00
|
|
|
|
2008-09-29 05:18:23 +02:00
|
|
|
class EditableEmailField extends EditableFormField {
|
|
|
|
|
2013-04-03 03:34:43 +02:00
|
|
|
private static $singular_name = 'Email Field';
|
2008-09-29 05:18:23 +02:00
|
|
|
|
2013-04-03 03:34:43 +02:00
|
|
|
private static $plural_name = 'Email Fields';
|
2008-09-29 05:18:23 +02:00
|
|
|
|
2014-04-16 01:48:10 +02:00
|
|
|
public function getSetsOwnError() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-04 03:39:08 +02:00
|
|
|
public function getFormField() {
|
2015-08-10 07:03:36 +02:00
|
|
|
$field = EmailField::create($this->Name, $this->EscapedTitle, $this->Default);
|
|
|
|
$this->doUpdateFormField($field);
|
2014-12-22 02:49:33 +01:00
|
|
|
return $field;
|
2008-09-29 05:18:23 +02:00
|
|
|
}
|
|
|
|
|
2009-04-21 05:44:13 +02:00
|
|
|
/**
|
|
|
|
* Return the validation information related to this field. This is
|
|
|
|
* interrupted as a JSON object for validate plugin and used in the
|
|
|
|
* PHP.
|
|
|
|
*
|
|
|
|
* @see http://docs.jquery.com/Plugins/Validation/Methods
|
|
|
|
* @return Array
|
|
|
|
*/
|
|
|
|
public function getValidation() {
|
2014-04-16 01:48:10 +02:00
|
|
|
return array_merge(parent::getValidation(), array(
|
2009-04-21 05:44:13 +02:00
|
|
|
'email' => true
|
2014-04-16 01:48:10 +02:00
|
|
|
));
|
2009-04-21 05:44:13 +02:00
|
|
|
}
|
2009-12-07 03:04:20 +01:00
|
|
|
}
|