Skip to content

Commit 448aa14

Browse files
committed
Add a data processor to handle the value none for the CSS class name
1 parent a649abd commit 448aa14

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

wcfsetup/install/files/lib/acp/form/UserRankAddForm.class.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,25 @@ function (IFormDocument $document, array $data, IStorableObject $object) {
145145

146146
$data['requiredGender'] = $data['requiredGender'] ?: null;
147147

148+
return $data;
149+
}
150+
)
151+
)
152+
->addProcessor(
153+
new CustomFormDataProcessor(
154+
'cssClassNameDataProcessor',
155+
static function (IFormDocument $document, array $parameters) {
156+
if (isset($parameters['data']['cssClassName']) && $parameters['data']['cssClassName'] === 'none') {
157+
$parameters['data']['cssClassName'] = '';
158+
}
159+
160+
return $parameters;
161+
},
162+
static function (IFormDocument $document, array $data, IStorableObject $object) {
163+
\assert($object instanceof UserRank);
164+
165+
$data['cssClassName'] = $data['cssClassName'] ?: 'none';
166+
148167
return $data;
149168
}
150169
)

0 commit comments

Comments
 (0)