Jelix\Core\AppInstance::loadPlugin PHP Method

loadPlugin() public method

load a plugin from a plugin directory (any type of plugins).
public loadPlugin ( string $name, string $type, string $suffix, string $classname, mixed $constructArg = null ) : null | object
$name string the name of the plugin
$type string the type of the plugin
$suffix string the suffix of the filename
$classname string the name of the class to instancy
$constructArg mixed the single argument for the constructor of the class. null = no argument.
return null | object null if the plugin doesn't exists
    public function loadPlugin($name, $type, $suffix, $classname, $constructArg = null)
    {
        if (!$this->includePlugin($name, $type, $suffix, $classname)) {
            return null;
        }
        if (!is_null($constructArg)) {
            return new $classname($constructArg);
        } else {
            return new $classname();
        }
    }