Skip to content

Latest commit

 

History

History
513 lines (479 loc) · 14.8 KB

File metadata and controls

513 lines (479 loc) · 14.8 KB

Gear Events

For those of you that use Laravel, Feather makes use of the Events system to power Gear events. Events are fired at points throughout the execution of Feather and your own custom events can be fired.

Event Naming Convention

Feather uses a very simple naming convention for all events that are fired. This is an event in its most basic form.

{category}: {timing} {event}

An example of this convention is as follows.

validation: before auth.register

The above event is fired before the registrations validation as assessed. The above event is useful when you want your Gear to add custom inputs to the registration form.

Asset Events

assets: change styles

Receives
Parameter Description
`object $container` Asset container being used by current theme.
Expects `void`
Fired after the controllers method has been run. An asset container for the theme is passed to the event allowing styles within the container to be modified.

assets: change scripts

Receives
Parameter Description
`object $container` Asset container being used by current theme.
Expects `void`
Fired after the controllers method has been run. An asset container for the theme is passed to the event allowing scripts within the container to be modified.

Controller Events

controller: before {controller.name}@{verb}.{method.name}

Receives
Parameter Description
`object $controller` Instance of the controller object being resolved.
Expects `void`
Fired before a given method on a given controller is executed. Listeners receive an instance of the controller object.

controller: after {controller.name}@{verb}.{method.name}

Receives
Parameter Description
`object $controller` Instance of the controller object being resolved.
Expects `void`
Fired after a given method on a given controller is executed. Listeners receive an instance of the controller object.

controller: override {controller.name}@{verb}.{method.name}

Receives
Parameter Description
`object $controller` Instance of the controller object being resolved.
Expects `mixed`
Overrides a given method on a given controller. No response needs to be returned meaning the event can interact with the `layout` property on the controller instance.

controller: create {controller.name}@{verb}.{method.name}

Receives
Parameter Description
`object $controller` Instance of the controller object being resolved.
Expects `mixed`
Create a method for the given HTTP verb on a given controller. As with overriding a method you can interact with the `layout` property on the controller instance.
**Don't forget!**

All controller events receive the controller instance meaning you can interact with the all methods and properties on that controller.

View Events

view: before category.title

Expects `mixed`
Fired before the category title. Expects a value to be returned.

view: after category.title

Expects `mixed`
Fired after the category title. Expects a value to be returned.

view: before category.discussion.counter

Expects `mixed`
Fired before the category discussion counter. Expects a value to be returned.

view: after category.discussion.counter

Expects `mixed`
Fired after the category discussion counter. Expects a value to be returned.

view: before category.discussion.title

Expects `mixed`
Fired before the category discussion title. Expects a value to be returned.

view: after category.discussion.title

Expects `mixed`
Fired after the category discussion title. Expects a value to be returned.

view: before category.discussion.meta

Expects `mixed`
Fired before the category discussion meta information. Expects a value to be returned.

view: after category.discussion.meta

Expects `mixed`
Fired after the category discussion meta information. Expects a value to be returned.

view: before category.discussion.stats

Expects `mixed`
Fired before the category discussion statistics. Expects a value to be returned.

view: after category.discussion.stats

Expects `mixed`
Fired after the category discussion statistics. Expects a value to be returned.

view: before template.title

Expects `mixed`
Fired before the template title. Expects a value to be returned.

view: after template.title

Expects `mixed`
Fired after the template title. Expects a value to be returned.

view: before template.meta

Expects `mixed`
Fired before the template meta. Expects a value to be returned.

view: after template.meta

Expects `mixed`
Fired after the template meta. Expects a value to be returned.

view: before register.rules

Expects `mixed`
Fired before the registration rules. Expects a value to be returned.

view: after register.rules

Expects `mixed`
Fired after the registration rules. Expects a value to be returned.