/** * Registers the needed JavaScript and inject the JS initialization code. * * Note that if a supported theme is set, all css in the assets/css/theme folder are published * but only the css for the theme is registred.Moreover, if the select theme is 'image', the * 'scrollText plugin option is cleared. */ public function registerClientScript() { $view = $this->getView(); $bundle = ScrollUpAsset::register($view); $bundle->theme = $this->theme; $bundle->themeDir = $this->themeDir; if ($this->themeDir) { $path = $view->getAssetManager()->publish($this->themeDir); // you can use an alias $theme_css = $path[1] . '/' . $this->theme . '.css'; $view->registerCssFile($theme_css); } if ($this->theme == self::THEME_IMAGE && isset($this->options['scrollText'])) { $this->options['scrollText'] = ''; } $options = empty($this->options) ? '{}' : Json::encode($this->options); $js = "\$.scrollUp({$options});"; $view->registerJs($js); }
/** * Registers the needed JavaScript and inject the JS initialization code. * * Note that if a supported theme is set, all css in the assets/css/theme folder are published * but only the css for the theme is registred.Moreover, if the select theme is 'image', the * 'scrollText plugin option is cleared. */ public function registerClientScript() { $view = $this->getView(); if ($this->theme) { if ($this->themeDir) { $path = $view->getAssetManager()->publish($this->themeDir); // you can use an alias $theme_css = $path[1] . '/' . $this->theme . '.css'; } else { $path = $view->getAssetManager()->publish('@bower/scrollup'); $theme_css = $path[1] . '/css/themes/' . $this->theme . '.css'; } $view->registerCSSFile($theme_css); if ($this->theme == self::THEME_IMAGE && isset($this->options['scrollText'])) { $this->options['scrollText'] = ''; } } ScrollUpAsset::register($view); $options = empty($this->options) ? '{}' : Json::encode($this->options); $js = "\$.scrollUp({$options});"; $view->registerJs($js); }