29b44ecd73c3dc864cb2f114bdb156c1bc8d1225
[GitHub/WoltLab/woltlab.github.io.git] /
1 <?php
2
3 namespace wcf\system\event\listener;
4
5 use wcf\acp\form\PersonAddForm;
6 use wcf\form\AbstractFormBuilderForm;
7 use wcf\system\form\builder\container\FormContainer;
8 use wcf\system\form\builder\field\DateFormField;
9
10 /**
11 * Handles setting the birthday when adding and editing people.
12 *
13 * @author Matthias Schmidt
14 * @copyright 2001-2021 WoltLab GmbH
15 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
16 * @package WoltLabSuite\Core\System\Event\Listener
17 */
18 class BirthdayPersonAddFormListener extends AbstractEventListener
19 {
20 /**
21 * @see AbstractFormBuilderForm::createForm()
22 */
23 protected function onCreateForm(PersonAddForm $form): void
24 {
25 /** @var FormContainer $dataContainer */
26 $dataContainer = $form->form->getNodeById('data');
27 $dataContainer->appendChild(
28 DateFormField::create('birthday')
29 ->label('wcf.person.birthday')
30 ->saveValueFormat('Y-m-d')
31 ->nullable()
32 );
33 }
34 }