Topics

Plugin initialization

Most plugins require adding plugin specific CSS and/or JS files or do other tasks before launching the controller. These tasks should be executed during plugin initialization.

Plugin initialization tasks should be performed by catching ipBeforeController event. To do this, you need to create Event class file Event.php in your plugin's root folder. Add a method named ipBeforeController() and place your plugin initialization code into it.

<?php
namespace Plugin\MyPlugin;

class Event
{
    public static function ipBeforeController()
    {
        // echo "Plugin initialized";
        ipAddCss('assets/pluginStyle.css');
        ipAddJs('assets/pluginScript.js');
    }

}

See also

comments powered by Disqus