Add legal notice and privacy policy links
[GitHub/WoltLab/woltlab.github.io.git] / pages / package / pip / package_pip_bbcode.md
CommitLineData
0b768461 1---
9324e6d4 2title: BBCode Package Installation Plugin
0b768461
MS
3sidebar: sidebar
4permalink: package_pip_bbcode.html
5folder: package/pip
6parent: package_pip
7---
8
c0b44564
TD
9Registers new BBCodes.
10
11## Components
12
13Each bbcode is described as an `<bbcode>` element with the mandatory attribute `name`.
14The `name` attribute must contain alphanumeric characters only and is exposed to the user.
15
16### `<htmlopen>`
17
18{% include callout.html content="Optional: Must not be provided if the BBCode is being processed a PHP class (`<classname>`)." type="info" %}
19
20The contents of this tag are literally copied into the opening tag of the bbcode.
21
22### `<htmlclose>`
23
24{% include callout.html content="Optional: Must not be provided if `<htmlopen>` is not given." type="info" %}
25
26Must match the `<htmlopen>` tag.
27Do not provide for self-closing tags.
28
29### `<classname>`
30
31The name of the class providing the bbcode output,
32the class has to implement the `wcf\system\bbcode\IBBCode` interface.
33
34BBCodes can be statically converted to HTML during input processing using a
35`wcf\system\html\metacode\converter\*MetaConverter` class. This class does not
36need to be registered.
37
38### `<wysiwygIcon>`
39
40{% include callout.html content="Optional" type="info" %}
41
42Name of the Font Awesome icon class to show in the editor toolbar.
43
44### `<buttonLabel>`
45
46{% include callout.html content="Optional: Must be provided if an icon is given." type="info" %}
47
48Explanatory text to show when hovering the icon.
49
50### `<sourcecode>`
51
52{% include warning.html content="Do not set this to `1` if you don't specify a PHP class for processing. You must perform XSS sanitizing yourself!" %}
53
54If set to `1` contents of this BBCode will not be interpreted,
55but literally passed through instead.
56
57### `<isBlockElement>`
58
0263c556 59Set to `1` if the output of this BBCode is a HTML block element (according to the HTML specification).
c0b44564
TD
60
61### `<attributes>`
62
63Each bbcode is described as an `<attribute>` element with the mandatory attribute `name`.
64The `name` attribute is a 0-indexed integer.
65
66#### `<html>`
67
68{% include callout.html content="Optional: Must not be provided if the BBCode is being processed a PHP class (`<classname>`)." type="info" %}
69
70The contents of this tag are copied into the opening tag of the bbcode.
71`%s` is replaced by the attribute value.
72
73#### `<validationpattern>`
74
75{% include callout.html content="Optional" type="info" %}
76
77Defines a regular expression that is used to validate the value of the attribute.
78
79#### `<required>`
80
81{% include callout.html content="Optional" type="info" %}
82
83Specifies whether this attribute must be provided.
84
85#### `<useText>`
86
87{% include callout.html content="Optional" type="info" %}
88{% include callout.html content="Should only be set to `1` for the attribute with name `0`." type="info" %}
89
90Specifies whether the text content of the BBCode should become this attribute's value.
91
92## Example
93
94```
95<?xml version="1.0" encoding="UTF-8"?>
96<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/vortex/bbcode.xsd">
97 <import>
98 <bbcode name="foo">
99 <classname>wcf\system\bbcode\FooBBCode</classname>
100 <attributes>
101 <attribute name="0">
102 <validationpattern>^\d+$</validationpattern>
103 <required>1</required>
104 </attribute>
105 </attributes>
106 </bbcode>
107
108 <bbcode name="example">
109 <htmlopen>div</htmlopen>
110 <htmlclose>div</htmlclose>
111 <isBlockElement>1</isBlockElement>
112 <wysiwygicon>fa-bath</wysiwygicon>
113 <buttonlabel>wcf.editor.button.example</buttonlabel>
114 </bbcode>
115 </import>
116</data>
117```