Style fixes.
This commit is contained in:
parent
a7a59b690a
commit
be4950ff88
43 changed files with 187 additions and 149 deletions
|
|
@ -5,16 +5,19 @@ namespace App\Form;
|
|||
/**
|
||||
* Models
|
||||
*/
|
||||
|
||||
use App\Model\Data\User;
|
||||
|
||||
/**
|
||||
* Phalcon Form
|
||||
*/
|
||||
|
||||
use Httpcb\Form as FormBase;
|
||||
|
||||
/**
|
||||
* Element types
|
||||
*/
|
||||
|
||||
use Phalcon\Forms\Element\Text,
|
||||
Phalcon\Forms\Element\Password,
|
||||
Phalcon\Forms\Element\Submit;
|
||||
|
|
@ -22,6 +25,7 @@ use Phalcon\Forms\Element\Text,
|
|||
/**
|
||||
* Validators
|
||||
*/
|
||||
|
||||
use Phalcon\Validation,
|
||||
Phalcon\Validation\Validator\Callback as CallbackValidator,
|
||||
Phalcon\Validation\Validator\Alnum as AlnumValidator,
|
||||
|
|
@ -54,7 +58,9 @@ class Registration extends FormBase
|
|||
'messageMinimum' => 'Username must be at least :min characters long.',
|
||||
]),
|
||||
new CallbackValidator([
|
||||
'callback' => function($data) { return User::findFirstByUsername($data['username']) === false; },
|
||||
'callback' => function ($data) {
|
||||
return User::findFirstByUsername($data['username']) === false;
|
||||
},
|
||||
'message' => 'The username already exists.',
|
||||
'attribute' => 'username',
|
||||
])
|
||||
|
|
@ -63,7 +69,7 @@ class Registration extends FormBase
|
|||
$this->add($username);
|
||||
|
||||
// Names
|
||||
foreach([ 'first-name' => 'Firstname', 'last-name' => 'Lastname' ] as $id => $label) {
|
||||
foreach (['first-name' => 'Firstname', 'last-name' => 'Lastname'] as $id => $label) {
|
||||
|
||||
$name = new Text($id, array(
|
||||
'class' => 'form-control',
|
||||
|
|
@ -87,7 +93,9 @@ class Registration extends FormBase
|
|||
|
||||
$email->addValidators([
|
||||
new CallbackValidator([
|
||||
'callback' => function($data) { return User::findFirstByEmail($data['email']) === false; },
|
||||
'callback' => function ($data) {
|
||||
return User::findFirstByEmail($data['email']) === false;
|
||||
},
|
||||
'message' => 'This email already exist.',
|
||||
])
|
||||
]);
|
||||
|
|
|
|||
Reference in a new issue