/** * Register client assets */ protected function registerAssets() { $view = $this->getView(); AlertAsset::register($view); if ($this->useSessionFlash) { $js = 'sweetAlert(' . $this->getOptions() . ');'; $view->registerJs($js, $view::POS_END); } }
use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\helpers\VarDumper; use yii\helpers\Url; use yii\web\view; use yii\web\JsExpression; use yiidreamteam\jstree\JsTree; use raoul2000\widget\pnotify\PNotifyAsset; use yii2mod\alert\AlertAsset; use kartik\select2\Select2; use kartik\select2\ThemeDefaultAsset; $this->title = 'Recipe Editor'; $this->params['breadcrumbs'][] = $this->title; PNotifyAsset::register($this); // load js for PNotify AlertAsset::register($this); // load for sweetalert ThemeDefaultAsset::register($this); // load this so that we can register another CSS for use AFTER this // Register the tree-edit css, this has to be done after the select2 theme is loaded, and in this case // we are using the default theme for the component. This all breaks if the theme is changed and // that asset must be manually loaded for this to keep the tree css file at the end of the list // need something like an option to say put to last... $this->registerCssFile('@web/css/tree-edit.css', ['depends' => ['kartik\\select2\\Select2Asset']]); //var_dump($this->getAssetManager()->bundles); //var_dump(\kartik\select2\ThemeDefaultAsset::className()); ?> <div class="recipe-tree-edit"> <h1><?php
/** * Register client assets */ protected function registerAssets() { if ($this->hasTitle()) { $view = $this->getView(); AlertAsset::register($view); $js = "sweetAlert({$this->getOptions()}, {$this->callback});"; $view->registerJs($js, $view::POS_END); } }