Documentation on Extension Manager
I planned to update documentation on WIKI site to include section on Extension Manager, but for some reason site was down this weekend. So I decided to publish it here for everybody who are interested to be able to take a look before I move it under WIKI when WIKI will return back in business. There four major classes that together represent Extension Manager API and extension writers can leverage these classes in many ways in their code. Top level object in the hierarchy is ExtensionManager itself and you can see class diagram for this class on the right. Below is a most important members and usage examples. As added benefit publishing it in the blog, you are welcome to comment and provide suggestions on how it could be improved for final version that will be published on WIKI. I personally consider it very important to have documentation that make sense – no matter how cool application features are, if people have no clue how to use them they are.. well, useless :)
Next week will be very tough for me as deadline on my day job for the project I'm working on is January 15, so I expect next weekend spending in the office and won't have a lot of time to spend on fun stuff, like BlogEngine. When my hands are free, I will add a lot of new features that will hopefully make writing extensions for BlogEngine even more fun than it is now.
Oh, and did you check latest post on Mads blog? There is a new widget framework for BlogEngine is coming, and this is just awesome - I have some code snippets that fit right into this concept. Can't wait to get my hands on it!
| Method | public static bool ExtensionEnabled(string extensionName) |
| Description | Returns true if extension is enabled. |
| Usage | if (ExtensionManager.ExtensionEnabled(“BBCode”))
| Method | public static void ChangeStatus(string extension, bool enabled) | | Description | Method to enable or disable extension. If set to false, on application load extansion will not be instanciated. | | Usage | ExtensionManager.ChangeStatus(“BBCode”, false); |
| Method | public static void SetAdminPage(string extension, string url) | | Description | Allows to set custom settings page to use instead of default page. | | Usage | ExtensionManager.SetAdminPage(“BBCode”, “~/path/to/mypage.aspx”); |
| Method | public static ExtensionSettings GetSettings(string extensionName) | | Description | Returns ExtensionSettings object | | Usage | ExtensionSettings _settings = ExtensionManager.GetSettings(“BBCode”); |
| Method | public static void SaveSettings(string extensionName, ExtensionSettings settings) | | Description | Changes to the settings object by default done in memory only, you'll need to use this method to save changes to the disk. | | Usage | ExtensionManager. SaveSettings(“BBCode”, _settings); |
| Method | public static bool ImportSettings(ExtensionSettings settings) | | Description | Unlike SaveSettings, ImportSettings only writes data to the disc if settings object is null, so it basically initializes settings first time your extension is added to ExtensionManager. You would normally use it to set default values for extension parameters. | | Usage | ExtensionManager.ImportSettings(_settings); |