Skip to content

Commit 0e2335f

Browse files
authored
Merge pull request #554 from WoltLab/6.2-tutorial-series-interactions
Update tutorial series (interactions)
2 parents f67ea82 + d0517b1 commit 0e2335f

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

docs/tutorial/series/part_1.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,7 @@ an action class, an editor class and a list class.
138138
filepath="tutorial/tutorial-series/part-1/files/lib/data/person/PersonAction.class.php"
139139
) }}
140140

141-
This implementation of `AbstractDatabaseObjectAction` is very basic and only sets the `$permissionsDelete` and `$requireACP` properties.
142-
This is done so that later on, when implementing the people list for the ACP, we can delete people simply via AJAX.
143-
`$permissionsDelete` has to be set to the permission needed in order to delete a person.
144-
We will later use the [userGroupOption package installation plugin](../../package/pip/user-group-option.md) to create the `admin.content.canManagePeople` permission.
145-
`$requireACP` restricts deletion of people to the ACP.
141+
This implementation of `AbstractDatabaseObjectAction` fulfills the minimum requirement for a database object action.
146142

147143
#### `PersonEditor`
148144

@@ -242,12 +238,36 @@ We will go piece by piece through the template code:
242238
1. We include the `header` template and set the page title `wcf.acp.person.list`.
243239
You have to include this template for every page!
244240
1. We set the content header and additional provide a button to create a new person in the content header navigation.
245-
1. As not all people are listed on the same page if many people have been created, we need a pagination for which we use the `pages` template plugin.
246-
The `{hascontent}{content}{/content}{/hascontent}` construct ensures the `.paginationTop` element is only shown if the `pages` template plugin has a return value, thus if a pagination is necessary.
247241
1. For the main part of the page we only need to call the `render()` method of the grid view.
248242
1. Lastly, the `footer` template is included that terminates the page.
249243
You also have to include this template for every page!
250244

245+
#### `PersonInteractions`
246+
247+
{jinja{ codebox(
248+
title="files/lib/system/interaction/admin/PersonInteractions.class.php",
249+
language="php",
250+
filepath="tutorial/tutorial-series/part-1/files/lib/system/interaction/admin/PersonInteractions.class.php"
251+
) }}
252+
253+
`PersonGridView` uses `PersonInteractions` to configure the available interaction options.
254+
In this case, we only define one option for deletion.
255+
`DeleteInteraction` expects the path of the RPC endpoint to be used for deleting the objects as its first parameter.
256+
257+
#### `DeletePerson`
258+
259+
{jinja{ codebox(
260+
title="files/lib/system/endpoint/controller/core/persons/DeletePerson.class.php",
261+
language="php",
262+
filepath="tutorial/tutorial-series/part-1/files/lib/system/endpoint/controller/core/persons/DeletePerson.class.php"
263+
) }}
264+
265+
`DeletePerson` is an [RPC endpoint](../../php/api/rpc_api.md).
266+
The path of the endpoint is defined by the `RequestType` attribute.
267+
The task of the endpoint is to first validate whether the call is valid and whether the necessary permissions are available.
268+
The action is then executed, in this case by calling PersonAction.
269+
270+
251271
Now, we have finished the page to manage the people so that we can move on to the forms with which we actually create and edit the people.
252272

253273
### Person Add Form

0 commit comments

Comments
 (0)