final public function registerViewPlugin(string $type, string $name, array $method):int
    {
        $si = SmartyEngineTemplate::getSmartyInstance($this->appMastering);
        if ($type !== "modifier" && $type != "function") {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined plugin type $type.",
                "solution" => "Allowed to modifier or function")));
        }
        if (is_array($method) && count($method) == 2) {
            $si->registerPlugin($type, $name, $method);
        } else {
            throw new Server500(new \ArrayObject(array("explain" => "You must enter a valid class method in this array",
                "solution" => "array('Class with namespace', 'class method')")));
        }
        return (1);
    }
final public function registerViewPlugin(string $type, string $name, array $method):int
    {
        $si = SmartyEngineTemplate::getSmartyInstance($this->appMastering);
        if ($type !== "modifier" && $type != "function") {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined plugin type $type.",
                "solution" => "Allowed to modifier or function")));
        }
        if (is_array($method) && count($method) == 2) {
            $si->registerPlugin($type, $name, $method);
        } else {
            throw new Server500(new \ArrayObject(array("explain" => "You must enter a valid class method in this array",
                "solution" => "array('Class with namespace', 'class method')")));
        }
        return (1);
    }
final public function registerViewPlugin ( string $ type , string $ name , array $ method ) : int { $ si = SmartyEngineTemplate :: getSmartyInstance ( $ this -> appMastering ) ; if ( $ type !== "modifier" && $ type != "function" ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Undefined plugin type $type." , "solution" => "Allowed to modifier or function" ) ) ) ; } if ( is_array ( $ method ) && count ( $ method ) == 2 ) { $ si -> registerPlugin ( $ type , $ name , $ method ) ; } else { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "You must enter a valid class method in this array" , "solution" => "array('Class with namespace', 'class method')" ) ) ) ; } return ( 1 ) ; }
Register a new view plugin
This plugin allow to use in your smarty view
@param string $type Method type (function or modifier)
@param string $name Method name
@param array $method This array contain class with namespace and class method
array('Class with namespace', 'class method')
@return int Return the register success
@throws Server500
@throws \SmartyException
Register a new view plugin This plugin allow to use in your smarty view