Skip to content

Commit 1c7681c

Browse files
committed
Relocate event code generator
1 parent 7c1c17e commit 1c7681c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/5.x/extend/events.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ See [Using Events in a Custom Module](kb:custom-module-events) for an end-to-end
1212

1313
This page covers customizing Craft’s native behavior by registering event handlers in your plugin, and how to implement [your own events](#custom-events) that other developers can take advantage of.
1414

15+
## Event Code Generator
16+
17+
Quickly find events and generate code samples. Many events will appear more than once, as they’re listed for each class that emits them—read about [discovering events](#discovering-events) for more information!
18+
19+
<event-browser source="craft-5" />
20+
1521
## Anatomy of an Event
1622

1723
We use “event” to describe the **name** and **sender** that uniquely identify it, as well as the actual <yii2:yii\base\Event> instance that is emitted.
@@ -67,7 +73,7 @@ The best way to discover an event is to get familiar with a known procedure by s
6773
A fresh Craft install can easily emit 100 or more events per request, so using your IDE’s _conditional breakpoint_ may be necessary to cut down on noise!
6874
:::
6975

70-
Directly searching the Craft source is a great way to learn about Craft-specific events—but it will miss a host of events emitted by Yii, as well as those that are inherited from parent classes. The [event browser](#event-code-generator) and generator below enumerates _all_ of those events, even if they’re technically defined by a parent.
76+
Directly searching the Craft source is a great way to learn about Craft-specific events—but it will miss a host of events emitted by Yii, as well as those that are inherited from parent classes. The [event browser](#event-code-generator) and generator enumerates _all_ of those events, even if they’re technically defined by a parent.
7177

7278
### Inherited Events
7379

@@ -233,12 +239,6 @@ $query->attachBehavior('myBehavior', new EventBehavior([
233239

234240
The second argument to the `EventBehavior` constructor tells the behavior to mimic <craft5:craft\base\Event::once()> and will only invoke your handler once. All handlers are treated the same way, but you may mix one-time and continuous handlers by attaching multiple `EventBehavior` instances.
235241

236-
## Event Code Generator
237-
238-
Select an event for more detail and a code snippet.
239-
240-
<event-browser source="craft-5" />
241-
242242
## Common Event Flows
243243

244244
### Adding Validation Rules

0 commit comments

Comments
 (0)