Adds min/max email length in UI and backend

This commit is contained in:
Vlad
2017-09-19 19:36:39 -04:00
parent 28c75c5b96
commit 697f9ba5bc
3 changed files with 14 additions and 4 deletions

View File

@@ -1,7 +1,9 @@
<?php
namespace MailPoet\Form\Block;
use MailPoet\Form\Util\FieldNameObfuscator;
use MailPoet\Models\ModelValidator;
abstract class Base {
protected static function getInputValidation($block, $extra_rules = array()) {
@@ -9,6 +11,8 @@ abstract class Base {
if($block['id'] === 'email') {
$rules['required'] = true;
$rules['minlength'] = ModelValidator::EMAIL_MIN_LENGTH;
$rules['maxlength'] = ModelValidator::EMAIL_MAX_LENGTH;
$rules['error-message'] = __('Please specify a valid email address.', 'mailpoet');
}
@@ -135,4 +139,4 @@ abstract class Base {
}
return join(' ', $modifiers);
}
}
}