Skip to content

Commit 9a5be9f

Browse files
author
Matthias Schmidt
committed
Fix code boxes on events page
1 parent 6ccfab1 commit 9a5be9f

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

docs/php/api/events.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Let's start with a simple example to illustrate how the event system works.
1313
Consider this pre-existing class:
1414

1515
{jinja{ codebox(
16-
"php",
17-
"php/api/events/ExampleComponent.class.php",
18-
"files/lib/system/example/ExampleComponent.class.php"
16+
title="files/lib/system/example/ExampleComponent.class.php",
17+
language="php",
18+
filepath="php/api/events/ExampleComponent.class.php"
1919
) }}
2020

2121
where an event with event name `getVar` is fired in the `getVar()` method.
@@ -42,9 +42,9 @@ else {
4242
Now, consider that we have registered the following event listener to this event:
4343

4444
{jinja{ codebox(
45-
"php",
46-
"php/api/events/ExampleEventListener.class.php",
47-
"files/lib/system/event/listener/ExampleEventListener.class.php"
45+
title="files/lib/system/event/listener/ExampleEventListener.class.php",
46+
language="php",
47+
filepath="php/api/events/ExampleEventListener.class.php"
4848
) }}
4949

5050
Whenever the event in the `getVar()` method is called, this method (of the same event listener object) is called.
@@ -84,18 +84,18 @@ The only thing to do is to call the `wcf\system\event\EventHandler::fireAction($
8484
Consider the following method which gets some text that the methods parses.
8585

8686
{jinja{ codebox(
87-
"php",
88-
"php/api/events/ExampleParser1.class.php",
89-
"files/lib/system/example/ExampleParser.class.php"
87+
title="files/lib/system/example/ExampleParser.class.php",
88+
language="php",
89+
filepath="php/api/events/ExampleParser1.class.php"
9090
) }}
9191

9292
After the default parsing by the method itself, the author wants to enable plugins to do additional parsing and thus fires an event and passes the parsed text as an additional parameter.
9393
Then, a plugin can deliver the following event listener
9494

9595
{jinja{ codebox(
96-
"php",
97-
"php/api/events/ExampleParserEventListener.class.php",
98-
"files/lib/system/event/listener/ExampleParserEventListener.class.php"
96+
title="files/lib/system/event/listener/ExampleParserEventListener.class.php",
97+
language="php",
98+
filepath="php/api/events/ExampleParserEventListener.class.php"
9999
) }}
100100

101101
which can access the text via `$parameters['text']`.
@@ -104,9 +104,9 @@ This example can also be perfectly used to illustrate how to name multiple event
104104
Let's assume that the author wants to enable plugins to change the text before and after the method does its own parsing and thus fires two events:
105105

106106
{jinja{ codebox(
107-
"php",
108-
"php/api/events/ExampleParser2.class.php",
109-
"files/lib/system/example/ExampleParser.class.php"
107+
title="files/lib/system/example/ExampleParser.class.php",
108+
language="php",
109+
filepath="php/api/events/ExampleParser2.class.php"
110110
) }}
111111

112112

@@ -134,9 +134,9 @@ The points in the program flow of [AbstractForm](../pages.md#abstractform) that
134134
All of these cases can be covered the by following code in which we assume that `wcf\form\ExampleAddForm` is the form to create example objects and that `wcf\form\ExampleEditForm` extends `wcf\form\ExampleAddForm` and is used for editing existing example objects.
135135

136136
{jinja{ codebox(
137-
"php",
138-
"php/api/events/ExampleAddFormListener.class.php",
139-
"files/lib/system/event/listener/ExampleAddFormListener.class.php"
137+
title="files/lib/system/event/listener/ExampleAddFormListener.class.php",
138+
language="php",
139+
filepath="php/api/events/ExampleAddFormListener.class.php"
140140
) }}
141141

142142
The `execute` method in this example just delegates the call to a method with the same name as the event so that this class mimics the structure of a form class itself.
@@ -154,7 +154,7 @@ Furthermore, the type-hinting of the parameter illustrates in which contexts the
154154
Lastly, the following XML file has to be used to register the event listeners (you can find more information about how to register event listeners on [the eventListener package installation plugin page](../../package/pip/event-listener.md)):
155155

156156
{jinja{ codebox(
157-
"xml",
158-
"php/api/events/eventListener.xml",
159-
"eventListener.xml"
157+
title="eventListener.xml",
158+
language="xml",
159+
filepath="php/api/events/eventListener.xml",
160160
) }}

0 commit comments

Comments
 (0)