Some questions about addons dev in v2 - Questions / FAQ?

Hello everyone!

I am currently migrating my asset optimization via an addon.

Some questions about addons dev:

  • How can I properly debug an addon with v2?
    For debugging at the moment I use this type of function:

    // debug function
    public function debug($message) {
        // get message
        if (!is_string($message) || !is_numeric($message))
            $message = json_encode($message);
    
        $time = date('Y-m-d H:i:s', time());
    
        // path
        $this->tmpDir = \rtrim($this->app->path('#tmp:'),"/\\");
        $this->logFile = $this->tmpDir.'/log.txt';
    
        // write file
        $this->app->helper('fs')->write($this->logFile, "$time - $message\r\n", FILE_APPEND);
    }
    

    is there another way ?

  • Where can we find a list of all available events?

  • The updateAssets() function has been replaced by what?

    • i use actually $this->app->module('assets')->update($assets[]) it’s the good way ?
  • I use this function $this->app->helper('asset')->image($options) for generate thumbnails

    • Is this the replacement for v1 functionnality thumbnail() ?
    • In $options array i see the cachefolder var, but if I modify it by ‘thumbs://’ for exemple it doesn’t work
  • What are the cases where the tmp cache folder is clear ?

Thanks @arthur for this awsome project V1 rocks and this new version seems to be an sucess too