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
{{ message }}
Repository navigation
Commit 6d5e6b6
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/migration/wsc62/php.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,3 +57,61 @@ class ArticleCategoryType extends AbstractCategoryType
57
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
58
59
59
Custom subclasses of `CategoryAddFormBuilderForm` do not require any changes for this to work.
60
+
61
+
## ACP Search Providers
62
+
63
+
The registration of ACP search providers has been overhauled ([WoltLab/WCF#6681](https://github.com/WoltLab/WCF/issues/6681)).
64
+
65
+
### Registering Providers Through an Event
66
+
67
+
Providers are now registered through the PSR-14 event `wcf\event\acp\search\provider\ProviderCollecting`.
68
+
See the [ACP search providers](../../package/acp-search-providers.md) page for the full API reference.
69
+
The `acpSearchProvider` package installation plugin and the underlying database object remain available but are deprecated and should no longer be used for new providers.
70
+
71
+
A bootstrap script registers an event listener that adds the provider instances:
static function (\wcf\event\acp\search\provider\ProviderCollecting $event) {
77
+
$event->register(
78
+
'com.example.myProvider',
79
+
new \example\system\search\acp\MyAcpSearchResultProvider()
80
+
);
81
+
}
82
+
);
83
+
```
84
+
85
+
The provider class must still implement `wcf\system\search\acp\IACPSearchResultProvider`.
86
+
The first argument of `register()` is the textual identifier that is also used as the language item key for the result group title (`wcf.acp.search.provider.{providerName}`).
87
+
88
+
Providers are sorted by their translated label; the explicit `showOrder` from the deprecated PIP is no longer evaluated for event-registered providers.
89
+
90
+
Providers that are still registered through the deprecated `acpSearchProvider` PIP continue to work and are merged with the event-registered providers, but they are shadowed by event-registered providers using the same `providerName`.
91
+
92
+
### Searching Through the RPC API
93
+
94
+
The legacy AJAX action `wcf\data\acp\search\provider\ACPSearchProviderAction::getSearchResultList()` has been replaced by the RPC endpoint `GET /core/acp/search`.
95
+
96
+
| Parameter | Type | Description |
97
+
|-----------|------|-------------|
98
+
|`query`|`non-empty-string`| The search query. |
99
+
|`provider`|`string` (optional) | Restrict the search to a single provider identified by its `providerName`. |
100
+
101
+
The response payload has the following shape:
102
+
103
+
```json
104
+
{
105
+
"results": [
106
+
{
107
+
"title": "Translated provider title",
108
+
"items": [
109
+
{ "title": "…", "link": "…", "subtitle": "…" }
110
+
]
111
+
}
112
+
]
113
+
}
114
+
```
115
+
116
+
The endpoint requires the `admin.general.canUseAcp` permission.
117
+
Each registered provider remains responsible for enforcing its own admin permissions inside `IACPSearchResultProvider::search()`.
The API for the ACP search providers allows you to add your own provider for the admin panel search.
4
+
5
+
Since WoltLab Suite 6.3 you can attach an event listener to the `wcf\event\acp\search\provider\ProviderCollecting` event inside a [bootstrap script](../package/bootstrap-scripts.md) to lazily register your ACP search providers.
6
+
7
+
The `register` method of the event expects the following parameters:
8
+
9
+
| Name | Type | Description |
10
+
|------|------|-------------|
11
+
|`$providerName`| string | Identifier of the provider; must be unique. Also used as the language item key for the result group title (`wcf.acp.search.provider.{$providerName}`). |
12
+
|`$provider`| IACPSearchResultProvider | Provider instance that implements `wcf\system\search\acp\IACPSearchResultProvider`. |
13
+
14
+
Providers are sorted by their translated label.
15
+
16
+
The provider class must implement `wcf\system\search\acp\IACPSearchResultProvider` and return a list of `wcf\system\search\acp\ACPSearchResult` instances from its `search()` method. The provider itself is responsible for enforcing the relevant admin permissions.
17
+
18
+
Example:
19
+
20
+
```php
21
+
<?php
22
+
23
+
use wcf\event\acp\search\provider\ProviderCollecting;
24
+
use wcf\system\event\EventHandler;
25
+
use wcf\system\search\acp\ACPSearchResult;
26
+
use wcf\system\search\acp\IACPSearchResultProvider;
27
+
use wcf\system\WCF;
28
+
29
+
final class FooACPSearchResultProvider implements IACPSearchResultProvider
30
+
{
31
+
#[\Override]
32
+
public function search(string $query)
33
+
{
34
+
if (!WCF::getSession()->hasPermission('admin.foo.canManageFoo')) {
35
+
return [];
36
+
}
37
+
38
+
$results = [];
39
+
// collect matching items and append:
40
+
// $results[] = new ACPSearchResult($title, $link, $subtitle);
41
+
42
+
return $results;
43
+
}
44
+
}
45
+
46
+
return static function (): void {
47
+
EventHandler::getInstance()->register(ProviderCollecting::class, static function (ProviderCollecting $event) {
48
+
$event->register(
49
+
'com.woltlab.foo.bar',
50
+
new FooACPSearchResultProvider()
51
+
);
52
+
});
53
+
};
54
+
```
55
+
56
+
The language item `wcf.acp.search.provider.com.woltlab.foo.bar` must be provided through the [language package installation plugin](pip/language.md) so that the provider appears in the search type dropdown and as the heading of its result group.
57
+
58
+
The legacy [`acpSearchProvider` package installation plugin](pip/acp-search-provider.md) and the associated database object `wcf\data\acp\search\provider\ACPSearchProvider` are deprecated as of WoltLab Suite 6.3. Providers that are still registered through the deprecated PIP keep working but are shadowed by event-registered providers using the same `providerName`.
Copy file name to clipboardExpand all lines: docs/package/pip/acp-search-provider.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# ACP Search Provider Package Installation Plugin
2
2
3
+
!!! warning "Deprecated in WoltLab Suite 6.3"
4
+
Use the [ACP search providers](../acp-search-providers.md) API based on the PSR-14 event `wcf\event\acp\search\provider\ProviderCollecting` to register ACP search providers.
5
+
See the [migration guide](../../migration/wsc62/php.md#acp-search-providers) for details.
6
+
3
7
Registers data provider for the admin panel search.
Copy file name to clipboardExpand all lines: docs/php/api/events.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -264,6 +264,7 @@ final class ValueDumpListener
264
264
|`wcf\event\acp\dashboard\box\PHPExtensionCollecting`| Requests the collection of PHP extensions for the system info ACP dashboard box. |
265
265
|`wcf\event\acp\dashboard\box\StatusMessageCollecting`| Requests the collection of status messages for the status message dashboard box. |
266
266
|`wcf\event\acp\menu\item\ItemCollecting`| Requests the collection of acp menu items. |
267
+
|`wcf\event\acp\search\provider\ProviderCollecting`| Requests the collection of acp search providers. |
267
268
|`wcf\event\cache\CacheCleared`| Indicates that a full cache clear was performed. |
268
269
|`wcf\event\comment\CommentCreated`| Indicates that a new comment has been created. |
269
270
|`wcf\event\comment\CommentPublished`| Indicates that a new comment has been published. This can happen directly when a comment is created or be delayed if a comment has first been checked and approved by a moderator. |
0 commit comments