You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/php/api/form_builder/form_fields.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -267,6 +267,36 @@ A category name of `null` signals that no category filter is used.
267
267
`AclFormField` objects register a [custom form field data processor](validation_data.md#customformfielddataprocessor) to add the relevant ACL object type id into the `$parameters` array directly using `{$objectProperty}_aclObjectTypeID` as the array key.
268
268
The relevant database object action method is expected, based on the given ACL object type id, to save the ACL option values appropriately.
269
269
270
+
#### Example
271
+
272
+
The following source code creates an `AclFormField` with the object type `foo.bar.acl`:
273
+
274
+
```php
275
+
FormContainer::create('aclContainer')
276
+
->label('foo.bar.acl')
277
+
->appendChildren([
278
+
AclFormField::create('acl')
279
+
->objectType('foo.bar.acl')
280
+
])
281
+
```
282
+
283
+
After submitting the form, the id of the object type is passed to the DatabaseObjectAction and can be used there to process the data with the help of the `ACLHandler`.
284
+
285
+
```php
286
+
use wcf\data\AbstractDatabaseObjectAction;
287
+
use wcf\system\acl\ACLHandler;
288
+
289
+
class FooAction extends AbstractDatabaseObjectAction {
290
+
public function create() {
291
+
$object = parent::create();
292
+
293
+
if (!empty($this->parameters['acl_aclObjectTypeID'])) {
0 commit comments