Tina4 Modules

Develop your system as a normal Tina4 project, when you're done developing it, change your index to have the following code.

\Tina4\Module::addModule("My Module", "1.0.0", "tina4cms", function(\Tina4\Config $config) {
      global $DBA; //access the database
      //All your things that need to run when you start
      if (!$DBA->tableExists("someTable")) {
        (new \Tina4\Migration(__DIR__."/migrations"))->doMigration();
      //Add a twig function as Example
       $config->addTwigFunction("render",  function ($content) {
        return \Tina4\renderTemplate($content);

Your module can now be included in any other Tina4 project

Powered by ComboStrap