Skip to content

Commit b0e7133

Browse files
committed
Add migration guide for category list pages
1 parent 78fda20 commit b0e7133

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

docs/migration/wsc62/php.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Migrating from WoltLab Suite 6.2 - PHP
2+
3+
## Category List Pages
4+
5+
The legacy category list pages based on `AbstractCategoryListPage` have been replaced by [Node Tree Views](../../php/api/node_tree_views.md).
6+
The new implementation renders the categories using `CategoryNodeTreeView` and integrates with the [Interactions](../../php/api/interactions.md) system, which provides drag and drop sorting, an interaction context menu and inline quick interactions out of the box.
7+
8+
To migrate an existing category list page to the new infrastructure, the following steps are required.
9+
10+
### Extend `AbstractCategoryNodeTreeViewPage`
11+
12+
Change the parent class of the list page from `AbstractCategoryListPage` to `AbstractCategoryNodeTreeViewPage` and update the type declaration of `$objectTypeName` from untyped to `string`:
13+
14+
```php
15+
class ArticleCategoryListPage extends AbstractCategoryNodeTreeViewPage
16+
{
17+
public $activeMenuItem = 'wcf.acp.menu.link.article.category.list';
18+
19+
public string $objectTypeName = 'com.woltlab.wcf.article.category';
20+
}
21+
```
22+
23+
The previously used template, action handlers and read methods are no longer required and can be removed.
24+
`AbstractCategoryNodeTreeViewPage` uses the `categoryNodeTreeView` template and creates the matching `CategoryNodeTreeView` instance automatically.
25+
26+
### Implement `getEditControllerClass()` and `getAddControllerClass()`
27+
28+
Two new methods have been added to `ICategoryType`:
29+
30+
- `getEditControllerClass(): string` returns the class name of the controller used to edit categories of this type.
31+
- `getAddControllerClass(): string` returns the class name of the controller used to add categories of this type.
32+
33+
Both methods must be implemented by every concrete category type so that the node tree view and the interactions can link to the correct edit and add forms.
34+
35+
```php
36+
class ArticleCategoryType extends AbstractCategoryType
37+
{
38+
#[\Override]
39+
public function getEditControllerClass(): string
40+
{
41+
return ArticleCategoryEditForm::class;
42+
}
43+
44+
#[\Override]
45+
public function getAddControllerClass(): string
46+
{
47+
return ArticleCategoryAddForm::class;
48+
}
49+
}
50+
```
51+
52+
`AbstractCategoryType` provides empty default implementations to avoid breaking existing third-party category types. Categories of types that do not provide these methods will not be editable through the node tree view.
53+
54+
### Pre-Selecting the Parent Category in the Add Form
55+
56+
`CategoryAddFormBuilderForm` now reads the optional `parentCategoryID` GET parameter and pre-selects the corresponding parent category in the add form.
57+
This is used by the “Add Child Category” interaction in the node tree view to allow users to directly create a child category for a given node.
58+
59+
Custom subclasses of `CategoryAddFormBuilderForm` do not require any changes for this to work.

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ nav:
153153
- 'Database PHP API': 'package/database-php-api.md'
154154

155155
- 'Migration':
156+
- 'From WoltLab Suite 6.2':
157+
- 'Deprecations and Removals': 'migration/wsc62/deprecations_removals.md'
158+
- 'PHP API': 'migration/wsc62/php.md'
156159
- 'From WoltLab Suite 6.1':
157160
- 'Deprecations and Removals': 'migration/wsc61/deprecations_removals.md'
158161
- 'PHP API': 'migration/wsc61/php.md'

0 commit comments

Comments
 (0)