Adding documentation for the `HtmlUpcastProcessor
authorCyperghost <olaf_schmitz_1@t-online.de>
Mon, 26 Feb 2024 12:11:32 +0000 (13:11 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Mon, 26 Feb 2024 12:11:32 +0000 (13:11 +0100)
docs/migration/wsc60/php.md [new file with mode: 0644]
mkdocs.yml

diff --git a/docs/migration/wsc60/php.md b/docs/migration/wsc60/php.md
new file mode 100644 (file)
index 0000000..28bde61
--- /dev/null
@@ -0,0 +1,30 @@
+# Migrating from WoltLab Suite 6.0 - PHP
+
+## HtmlUpcastProcessor
+
+The `HtmlUpcastProcessor` is intended for use in all forms where the CKEditor5 is available as an input field. Its
+primary purpose is to inject necessary information into the HTML to ensure correct rendering within the editor. It is
+important to note that the `HtmlUpcastProcessor` is not designed for content storage and should be utilized within
+the `assignVariables` method.
+
+#### Example
+
+```php
+namespace wcf\form;
+
+use wcf\system\html\upcast\HtmlUpcastProcessor;
+
+class MyForm extends AbstractForm {
+   
+    public string $messageObjectType = ''; // object type of `com.woltlab.wcf.message`
+    public string $text = '';
+    
+    public function assignVariables() {
+        parent::assignVariables();
+        
+        $upcastProcessor = new HtmlUpcastProcessor();
+        $upcastProcessor->process($this->text ?? '', $this->messageObjectType, 0);
+        WCF::getTPL()->assign('text', $upcastProcessor->getHtml());
+    }
+}
+```
index 38a959e32cd6b57827a84c9e47130f2afc0bba67..62bd81f4a9d3d785214fb74641a04f6055fe5d92 100644 (file)
@@ -116,6 +116,7 @@ nav:
 
   - 'Migration':
       - 'From WoltLab Suite 6.0':
+          - 'PHP API': 'migration/wsc60/php.md'
           - 'Deprecations and Removals': 'migration/wsc60/deprecations_removals.md'
       - 'From WoltLab Suite 5.5':
           - 'PHP API': 'migration/wsc55/php.md'