Skip to content

Commit c75ff22

Browse files
committed
Group: Use FormValidator shortcuts instead of FormValidator:addElement(
1 parent 91ecc61 commit c75ff22

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

main/inc/lib/usergroup.lib.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1966,10 +1966,7 @@ public function setForm($form, $type = 'add', $data = [])
19661966
$form->addHeader($header);
19671967

19681968
// Name
1969-
$form->addElement('text', 'name', get_lang('Name'), ['maxlength' => 255]);
1970-
$form->applyFilter('name', 'trim');
1971-
1972-
$form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
1969+
$form->addText('name', get_lang('Name'), true, ['maxlength' => 255]);
19731970
$form->addRule('name', '', 'maxlength', 255);
19741971

19751972
// Description
@@ -1986,13 +1983,12 @@ public function setForm($form, $type = 'add', $data = [])
19861983
}
19871984

19881985
// url
1989-
$form->addElement('text', 'url', get_lang('Url'));
1990-
$form->applyFilter('url', 'trim');
1986+
$form->addText('url', get_lang('Url'), false);
19911987

19921988
// Picture
19931989
$allowed_picture_types = $this->getAllowedPictureExtensions();
19941990

1995-
$form->addElement('file', 'picture', get_lang('AddPicture'));
1991+
$form->addFile('picture', get_lang('AddPicture'));
19961992
$form->addRule(
19971993
'picture',
19981994
get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
@@ -2003,7 +1999,7 @@ public function setForm($form, $type = 'add', $data = [])
20031999
if (isset($data['picture']) && strlen($data['picture']) > 0) {
20042000
$picture = $this->get_picture_group($data['id'], $data['picture'], 80);
20052001
$img = '<img src="'.$picture['file'].'" />';
2006-
$form->addElement('label', null, $img);
2002+
$form->addLabel(null, $img);
20072003
$form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
20082004
}
20092005

0 commit comments

Comments
 (0)