/** * Register assets */ protected function registerAssets() { $view = $this->getView(); LinkPreviewAsset::register($view); $options = $this->getClientOptions(); $view->registerJs("\$('{$this->selector}').linkPreview({$options});", $view::POS_END); }
/** * Executes the widget. * @return string the result of widget execution to be outputted. */ public function run() { $id = $this->id; $view = $this->getView(); LinkPreviewAsset::register($view); $options = Json::encode($this->clientOptions); $view->registerJs("\$('#{$id}').linkPreview({$options});", $view::POS_END); parent::run(); }