Skip to content

Commit f31298f

Browse files
authored
Merge pull request #502 from WoltLab/6.2-recent-activity-image
Document image support in recent activities
2 parents 508276f + 2233bac commit f31298f

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

docs/migration/wsc61/php.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
```

docs/php/api/user_activity_events.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use wcf\data\user\activity\event\ViewableUserActivityEvent;
2727
use wcf\system\user\activity\event\IUserActivityEvent;
2828
use wcf\system\WCF;
2929
use wcf\util\StringUtil;
30+
use wcf\system\file\processor\ImageData;
3031

3132
final 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
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ nav:
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':

0 commit comments

Comments
 (0)