protected function registerPlugin()
    {
        $id = $this->options['id'];

        //get the displayed view and register the needed assets
        $view = $this->getView();
        MasonryAsset::register($view);
        ImagesLoadedAsset::register($view);

        $js = [];
        $js[] = "var mscontainer$id = $('#$id');";
        $js[] = "mscontainer$id.imagesLoaded(function(){mscontainer$id.masonry()});";
        
        $view->registerJs(implode("\n", $js),View::POS_END);
    }