From f5fdbb9e8211500ce8ffc959808b7891646f9f3c Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 9 Jan 2021 14:49:45 -0500 Subject: Add class autoload for extension (#3350) When an extension defines an `autoload` method, it will be registered automatically before enabling the extension. For the extension creator, it's easier because there is no need to register it manually. --- docs/en/developers/03_Backend/05_Extensions.md | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs') diff --git a/docs/en/developers/03_Backend/05_Extensions.md b/docs/en/developers/03_Backend/05_Extensions.md index 1ddfdb208..e280f9c0b 100644 --- a/docs/en/developers/03_Backend/05_Extensions.md +++ b/docs/en/developers/03_Backend/05_Extensions.md @@ -296,6 +296,11 @@ In addition, you will have a number of methods directly inherited from `Minz_Ext * `getFileUrl($filename, $type)` will return the URL to a file in the `static` directory. The first parameter is the name of the file (without `static /`), the second is the type of file to be used (`css` or` js`). * `registerController($base_name)` will tell Minz to take into account the given controller in the routing system. The controller must be located in your `Controllers` directory, the name of the file must be` Controller.php` and the name of the `FreshExtension__Controller` class. +> If your extension code is scattered in different classes, you need to load their source before using them. +> Of course you could include the files manually, but it's more efficient to load them automatically. +> To do so, you just need to define the `autoload` method which will include them when needed. +> This method will be registered automatically when the extension is enabled. + **TODO** * `registerViews()` -- cgit v1.2.3