silverstripe-userforms/code/model/editableformfields/EditableEmailField.php
2015-08-11 16:55:23 +12:00

36 lines
784 B
PHP
Executable File

<?php
/**
* EditableEmailField
*
* Allow users to define a validating editable email field for a UserDefinedForm
*
* @package userforms
*/
class EditableEmailField extends EditableFormField {
private static $singular_name = 'Email Field';
private static $plural_name = 'Email Fields';
public function getSetsOwnError() {
return true;
}
public function getFormField() {
$field = EmailField::create($this->Name, $this->EscapedTitle, $this->Default);
$this->doUpdateFormField($field);
return $field;
}
/**
* Updates a formfield with the additional metadata specified by this field
*
* @param FormField $field
*/
protected function updateFormField($field) {
parent::updateFormField($field);
$field->setAttribute('data-rule-email', true);
}
}