ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
LastName.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\User\Profile\Fields\NoOverrides;
28
29class LastName implements FieldDefinition
30{
31 use NoOverrides;
32
33 public function getIdentifier(): string
34 {
35 return 'lastname';
36 }
37
38 public function getLabel(Language $lng): string
39 {
40 return $lng->txt($this->getIdentifier());
41 }
42
43 public function getSection(): AvailableSections
44 {
45 return AvailableSections::PersonalData;
46 }
47
48 public function visibleInRegistrationForcedTo(): ?bool
49 {
50 return true;
51 }
52
53 public function visibleToUserForcedTo(): ?bool
54 {
55 return true;
56 }
57
59 {
60 return true;
61 }
62
63 public function visibleInCoursesForcedTo(): ?bool
64 {
65 return true;
66 }
67
68 public function visibleInGroupsForcedTo(): ?bool
69 {
70 return true;
71 }
72
73 public function visibleInStudyProgrammesForcedTo(): ?bool
74 {
75 return true;
76 }
77
78 public function requiredForcedTo(): ?bool
79 {
80 return true;
81 }
82
83 public function availableInCertificatesForcedTo(): ?bool
84 {
85 return true;
86 }
87
88 public function getLegacyInput(
91 ?\ilObjUser $user = null
93 $input = new \ilTextInputGUI($this->getLabel($lng));
94 $input->setMaxLength(128);
95 if ($user === null) {
96 return $input;
97 }
98 $input->setValue(
99 $this->retrieveValueFromUser($user)
100 );
101 return $input;
102 }
103
104 public function addValueToUserObject(
105 \ilObjUser $user,
106 mixed $input,
107 ?\ilPropertyFormGUI $form = null
108 ): \ilObjUser {
109 $user->setLastname($input);
110 return $user;
111 }
112
113 public function retrieveValueFromUser(\ilObjUser $user): string
114 {
115 return $user->getLastname();
116 }
117}
getLegacyInput(Language $lng, Context $context, ?\ilObjUser $user=null)
You don't need to add a post_var to the input as the User will handle this for you,...
Definition: LastName.php:88
addValueToUserObject(\ilObjUser $user, mixed $input, ?\ilPropertyFormGUI $form=null)
Definition: LastName.php:104
This class represents a property in a property form.
User class.
This class represents a property form user interface.
This class represents a text property in a property form.
setMaxLength(?int $a_maxlength)
global $lng
Definition: privfeed.php:31
$context
Definition: webdav.php:31