File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ # Migrating from WoltLab Suite 6.1 - PHP
2+
3+ ## User Activity Events
4+
5+ User activity events can optionally be provided with an image.
6+ The ` setImage() ` method expects an object of type ` wcf\system\file\processor\ImageData ` as a parameter.
7+
8+ Classes that implement the interface ` wcf\system\file\processor\IImageDataProvider ` provide the ` getImageData() ` method,
9+ that returns a suitable ` ImageData ` object.
10+
11+ #### Example
12+
13+ ``` php
14+ $object = new FooBarObject(1);
15+ $event->setTitle(WCF::getLanguage()->getDynamicVariable('com.foo.bar', [
16+ // variables
17+ ]));
18+ $event->setDescription(
19+ StringUtil::encodeHTML(
20+ StringUtil::truncate($object->getPlainTextMessage(), 500)
21+ ),
22+ true
23+ );
24+ $event->setLink($object->getLink());
25+ $event->setImage(new ImageData('image_src', 800, 600));
26+ ```
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ use wcf\data\user\activity\event\ViewableUserActivityEvent;
2727use wcf\system\user\activity\event\IUserActivityEvent;
2828use wcf\system\WCF;
2929use wcf\util\StringUtil;
30+ use wcf\system\file\processor\ImageData;
3031
3132final class FooUserActivityEvent implements IUserActivityEvent
3233{
@@ -57,6 +58,8 @@ final class FooUserActivityEvent implements IUserActivityEvent
5758 true
5859 );
5960 $event->setLink($foo->getLink());
61+ // Optionally set an image.
62+ $event->setImage(new ImageData('image_src', 800, 600));
6063 }
6164}
6265```
Original file line number Diff line number Diff line change 130130 - ' Migration ' :
131131 - ' From WoltLab Suite 6.1 ' :
132132 - ' Deprecations and Removals ' : ' migration/wsc61/deprecations_removals.md'
133+ - ' PHP API ' : ' migration/wsc61/php.md'
133134 - ' Templates ' : ' migration/wsc61/templates.md'
134135 - ' Quotes ' : ' migration/wsc61/quotes.md'
135136 - ' From WoltLab Suite 6.0 ' :
You can’t perform that action at this time.
0 commit comments