1
0
mirror of https://github.com/flarum/core.git synced 2025-08-05 07:57:46 +02:00

Created Extensions (markdown)

tobscure
2014-12-19 21:38:21 -08:00
parent c7e8c4a743
commit 0f6a4cf47f

25
Extensions.md Normal file

@@ -0,0 +1,25 @@
At its core, Flarum actually contains [very few features](Features). It is really just a bare-bones platform for discussion. All of the power comes in the form of **Extensions**.
Currently, no Extensions actually exist. The priority in development is to build out the core while thinking carefully about what Extensions will need to do and how they will be able to do it. Thus, the following discussion is mostly theoretical.
Usually, an Extension will need to add functionality to all three layers of the application: the Laravel layers (core, API), and the Ember.js app. For example, a *Sticky* extension would need to:
- Run a migration to add a “sticky” column in the domain/persistence layer
- Add its own commands and domain events to change a discussions sticky status
- Alter discussion-reading/writing API endpoints
- Add a sticky indicator and controls to the Ember app
Various strategies are planned/implemented to allow this kind of extensibility:
## Laravel
- Listening for domain events
- Listening for standard events (e.g. when a discussions attributes are being serialized for an API endpoint)
- Adding JS/CSS files to be included with the Ember app via an asset manager
## Ember
- A “hook” template helper, so that plugins can hook on and render their own templates at certain positions
- Overriding templates completely
- Overriding methods and adding event listeners with Ember.Objects reopen and reopenClass
- Use of ContainerViews so that controls can be easily manipulated in a consistent manner, without altering templates