Tendoo CMS : How to require a module to be active - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: External Resources (https://forum.codeigniter.com/forumdisplay.php?fid=7) +--- Forum: Addins (https://forum.codeigniter.com/forumdisplay.php?fid=13) +--- Thread: Tendoo CMS : How to require a module to be active (/showthread.php?tid=62536) |
Tendoo CMS : How to require a module to be active - Blair2004 - 07-25-2015 Hi,
how are you going so far since the the first guide to create a module for tendoo cms 1.5 ? As you may already know, Tendoo has a almost fully hookable UI and every features are actually part of modules. That why sometimes you may require a module to be active before proceeding, and by the same way, i'll introduce UI notices. Are you ready ? here we go Note : I assume that you already know how to create a tendoo module, if it's not the case, read this. 1. Download Tendoo from Github This is the first step, before everything download tendoo from github. 2. Add conditionnal tag for the requirement This is done through you module main file, while using "after_app_init" action hook. Modules are handled by a class named "Modules" which has only static methods. between thos methods, there is "is_active", which return a boolean if a module is enabled (true) or if it's not (false). Here is an example : PHP Code: <?php as you're seeing in this example, when the module is not enabled, we use a filter hook named "ui_notices", which let us add custom notices array inside the queue. This array should have thoses keys :
don't forget to return this updated array. When the module is not active, a notice is being displayed on the dashboard like this : That's all for now. Any question ? Thanks for readding this |