Archived
1
0
Fork 0

Style fixes.

This commit is contained in:
Henrik Hautakoski 2023-04-30 16:52:38 +02:00
parent a7a59b690a
commit 8b44550f06
42 changed files with 186 additions and 148 deletions

View file

@ -5,16 +5,19 @@ namespace App\Form;
/**
* Models
*/
use App\Model\Data\User as UserModel;
/**
* 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\Validator\Callback as CallbackValidator,
Phalcon\Validation\Validator\Uniqueness as UniquenessValidator,
Phalcon\Validation\Validator\Alnum as AlnumValidator,
@ -56,15 +60,15 @@ class UserSettings extends FormBase
// Id
if ($entity && $entity->getId()) {
$id = new Text('id', array(
'class' => 'form-control',
'readonly' => '',
'disabled' => 'disabled',
));
$id = new Text('id', array(
'class' => 'form-control',
'readonly' => '',
'disabled' => 'disabled',
));
$id->addValidator(new IdenticalValidator([
'accepted' => $entity->getId(),
'allowEmpty' => true
'allowEmpty' => true
]));
$id->setLabel('ID');
@ -86,7 +90,7 @@ class UserSettings extends FormBase
);
if ($entity && strlen($entity->getUsername())) {
$validator_options['except'] = [ $entity->getUsername() ];
$validator_options['except'] = [$entity->getUsername()];
}
$username->addValidators([
@ -116,12 +120,12 @@ class UserSettings extends FormBase
'class' => 'form-control',
'placeholder' => 'Email',
'readonly' => '',
'disabled' => 'disabled',
'disabled' => 'disabled',
));
$email->addValidator(new IdenticalValidator([
'accepted' => $entity->getEmail(),
'allowEmpty' => true
'allowEmpty' => true
]));
} else {
$email = new Text('email', array(
@ -136,7 +140,7 @@ class UserSettings extends FormBase
];
if ($entity && strlen($entity->getEmail())) {
$validator_options['except'] = [ $entity->getEmail() ];
$validator_options['except'] = [$entity->getEmail()];
}
$email->addValidators([
@ -191,7 +195,7 @@ class UserSettings extends FormBase
if ($this->_admin === false && $entity && strlen($entity->getPassword()) > 0) {
$validation->add('passwordCurrent', new CallbackValidator([
'callback' => function($data) {
'callback' => function ($data) {
$new_pw = $data['passwordNew'];
if (strlen($new_pw) > 0) {
$value = $data['passwordCurrent'];