Skip to content

Commit e0b7e48

Browse files
committed
Update the documentation for the revised quote API
Closes #536
1 parent 04581eb commit e0b7e48

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

docs/migration/wsc61/quotes.md

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,13 @@ Quotes are now stored client-side in the browser's local storage, allowing synch
55

66
## Using the New Quote System
77

8-
The interfaces `wcf\data\IMessageQuoteAction` and `wcf\system\message\quote\IMessageQuoteHandler` are no longer required to generate the quotes, and the implemented classes or functions can be completely removed.
9-
Since the interface `IMessageQuoteHandler` has been deprecated, the ObjectType no longer requires any information about an associated class.
10-
11-
```XML
12-
<?xml version="1.0" encoding="UTF-8"?>
13-
<data xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com http://www.woltlab.com/XSD/6.0/objectType.xsd">
14-
<import>
15-
<type>
16-
<name>com.woltlab.foo</name>
17-
<definitionname>com.woltlab.wcf.message.quote</definitionname>
18-
</type>
19-
</import>
20-
</data>
21-
```
22-
23-
The object that can be quoted:
8+
The interface `wcf\system\message\quote\IMessageQuoteHandler` has been modified to now only require the implementation of `getMessage()`.
9+
This new method is responsible to fetch the message, perform any validation and load embedded objects whenver applicable.
2410

25-
- MUST implement the interface `wcf\data\IMessage`.
26-
- SHOULD implement the interface `wcf\data\IEmbeddedMessageObject`.
11+
All other methods previously implemented in quote handlers can be removed alongside with the methods required by the now deprecated interface `wcf\data\IMessageQuoteAction`.
2712

28-
Using of `WoltLabSuite/Core/Ui/Message/Quote` is no longer required and only `WoltLabSuite/Core/Component/Quote/Message::registerContainer()` should be used so that a message can be quoted
13+
`WoltLabSuite/Core/Ui/Message/Quote` is now deprecated and may only be used with legacy implementations relying on `wcf\data\IMessageQuoteAction`.
14+
Updated implementations must use `WoltLabSuite/Core/Component/Quote/Message::registerContainer()` which requires only the container selectors and the name of the object type.
2915

3016
```smarty
3117
<!-- Previous -->
@@ -34,25 +20,25 @@ Using of `WoltLabSuite/Core/Ui/Message/Quote` is no longer required and only `Wo
3420
require(["WoltLabSuite/Core/Ui/Message/Quote"], ({ UiMessageQuote }) => {
3521
{include file='shared_messageQuoteManager' wysiwygSelector='text' supportPaste=true}
3622
37-
new UiMessageQuote($quoteManager, "wcf\\data\\foo\\Foo", "com.woltlab.foo", ".message", ".messageBody", ".messageBody > .messageText", true);
23+
new UiMessageQuote($quoteManager, "wcf\\data\\foo\\FooAction", "com.woltlab.foo", ".message", ".messageBody", ".messageBody > .messageText", true);
3824
});
3925
});
4026
</script>
4127
4228
<!-- Use instead -->
4329
<script data-relocate="true">
4430
require(["WoltLabSuite/Core/Component/Quote/Message"], ({ registerContainer }) => {
45-
registerContainer(".message", ".messageBody", "wcf\\data\\foo\\Foo", "com.woltlab.foo");
31+
registerContainer(".message", ".messageBody", "com.woltlab.foo");
4632
});
4733
</script>
4834
```
4935

5036
## Adjustments to the forms
5137

52-
The functions `MessageQuoteManager::readFormParameters()` and `MessageQuoteManager::saved()` must be called both in the form for creating and editing the entry.
53-
This is necessary if the text input does support quotes. Regardless of whether the entry itself can be quoted later or not.
38+
The functions `MessageQuoteManager::readFormParameters()` and `MessageQuoteManager::saved()` must be called in the forms for creating and editing an entry.
39+
These calls are required whenver a text input supports quotes, regardless of whether the entry itself can be quoted or not.
5440

55-
```PHP
41+
```php
5642
use wcf\system\message\quote\MessageQuoteManager;
5743

5844
class FooAddForm extends \wcf\form\MessageForm {
@@ -64,7 +50,7 @@ class FooAddForm extends \wcf\form\MessageForm {
6450

6551
// …
6652

67-
// Read the quotes that are to be deleted after the message has been successfully saved
53+
// Read the quotes that are to be deleted after the message has been successfully saved.
6854
MessageQuoteManager::getInstance()->readFormParameters();
6955
}
7056

@@ -75,7 +61,7 @@ class FooAddForm extends \wcf\form\MessageForm {
7561

7662
// …
7763

78-
// Save the used quotes so that they're deleted on the client with the next request
64+
// Save the used quotes so that they're deleted on the client with the next request.
7965
MessageQuoteManager::getInstance()->saved();
8066
}
8167
}

0 commit comments

Comments
 (0)