Registers a CSS file.
public registerCssFile ( string $url, array $options = [], string $key = null ) | ||
$url | string | the CSS file to be registered. |
$options | array | the HTML attributes for the link tag. Please refer to [[Html::cssFile()]] for the supported options. The following options are specially handled and are not treated as HTML attributes: - `depends`: array, specifies the names of the asset bundles that this CSS file depends on. |
$key | string | the key that identifies the CSS script file. If null, it will use $url as the key. If two CSS files are registered with the same key, the latter will overwrite the former. |
/** * Registers the CSS and JS files with the given view. * @param \yii\web\View $view the view that the asset files are to be registered with. */ public function registerAssetFiles($view) { $manager = $view->getAssetManager(); foreach ($this->css as $css) { $view->registerCssFile($manager->getAssetUrl($this, $css), $this->cssOptions); } $view->registerJsFile($this->basketJs); $jsFiles = []; foreach ($this->js as $js) { $jsFiles[] = Json::encode(['url' => $manager->getAssetUrl($this, $js)]); } $view->registerJs(sprintf('basket.require(%s);', implode(",\r\n", $jsFiles)), View::POS_END); }
/** * Registers the CSS and JS files with the given view. * public $css = [ * 'css/bootstrap.min.css', * 'css/font-awesome.min.css' => array('position' => View::POS_END, 'condition' => 'lte IE 8') * ] * @param \yii\web\View $view the view that the asset files are to be registered with. */ public function registerAssetFiles($view) { foreach ($this->js as $value) { if (is_array($value)) { if (isset($value['file'])) { $js = $value['file']; unset($value['file']); $options = ArrayHelper::merge($this->jsOptions, $value); } else { if (isset($value['content'])) { $position = isset($value['position']) ? $value['position'] : $view::POS_READY; $view->registerJs($value['content'], $position); } continue; } } else { $js = $value; $options = $this->jsOptions; } if ($js[0] !== '/' && $js[0] !== '.' && strpos($js, '://') === false) { $view->registerJsFile($this->baseUrl . '/' . $js, [], $options); } else { $view->registerJsFile($js, [], $options); } } foreach ($this->css as $value) { if (is_array($value)) { if (isset($value['file'])) { $css = $value['file']; unset($value['file']); $options = ArrayHelper::merge($this->cssOptions, $value); } else { if (isset($value['content'])) { $position = isset($value['position']) ? $value['position'] : $view::POS_READY; $view->registerCss($value['content'], $position); } continue; } } else { $css = $value; $options = $this->cssOptions; } if ($css[0] !== '/' && $css[0] !== '.' && strpos($css, '://') === false) { $view->registerCssFile($this->baseUrl . '/' . $css, [], $options); } else { $view->registerCssFile($css, [], $options); } } }
/** * @param string $url * @param array $options Ignored * @param null $key Ignored */ public function registerCssFile($url, $options = [], $key = null) { Yii::log('Registering ' . $url, 'info', __METHOD__); // Register in parent in order to trigger any errors with the parameters parent::registerCssFile($url, $options, $key); // Register using Yii1 client script $clientScript = Yii::app()->getClientScript(); $url = $this->getAssetsUrl() . $url; $clientScript->registerCssFile($url); }
public function registerAssetFiles(View $view) { $manager = $view->getAssetManager(); $arr_js = $this->js; $arr_css = $this->css; if (isset($view->context->layout) && $view->context->layout === 'parts') { $arr_js = $this->js_parts; $arr_css = $this->css_parts; } foreach ($arr_js as $js) { $view->registerJsFile($manager->getAssetUrl($this, $js), $this->jsOptions); } foreach ($arr_css as $css) { $view->registerCssFile($manager->getAssetUrl($this, $css), $this->cssOptions); } }
/** * Registers the CSS and JS files with the given view. * @param \yii\web\View $view the view that the asset files are to be registered with. */ public function registerAssetFiles($view) { $manager = $view->getAssetManager(); foreach ($this->js as $js) { $view->registerJsFile($manager->getAssetUrl($this, $js), $this->jsOptions); } foreach ($this->css as $css) { // FIX ------------------------------------------------------------- // save converted files in to css folder instead of scss $pos = strrpos($css, '.'); $ext = $pos !== false ? substr($css, $pos + 1) : null; if ($ext == 'css') { $css = preg_replace("/^scss\\//i", "css/", $css); } // ----------------------------------------------------------------- $view->registerCssFile($manager->getAssetUrl($this, $css), $this->cssOptions); } }
/** * Registers the CSS and JS files with the given view. * @param \yii\web\View $view the view that the asset files are to be registered with. */ public function registerAssetFiles($view) { $manager = $view->getAssetManager(); foreach ($this->js as $js) { if (is_array($js)) { $file = array_shift($js); $options = ArrayHelper::merge($this->jsOptions, $js); $view->registerJsFile($manager->getAssetUrl($this, $file), $options); } else { $view->registerJsFile($manager->getAssetUrl($this, $js), $this->jsOptions); } } foreach ($this->css as $css) { if (is_array($css)) { $file = array_shift($css); $options = ArrayHelper::merge($this->cssOptions, $css); $view->registerCssFile($manager->getAssetUrl($this, $file), $options); } else { $view->registerCssFile($manager->getAssetUrl($this, $css), $this->cssOptions); } } }
/** * Registers the CSS and JS files with the given view. * @param \yii\web\View $view the view that the asset files are to be registered with. */ public function registerAssetFiles($view) { $manager = $view->getAssetManager(); foreach ($this->js as $js) { $view->registerJsFile($manager->getAssetUrl($this, $js), $this->jsOptions); } foreach ($this->css as $css) { $view->registerCssFile($manager->getAssetUrl($this, $css), $this->cssOptions); } }
use nirvana\infinitescroll\InfiniteScrollPager; use yii\widgets\Pjax; use yii\bootstrap\Modal; use yii\bootstrap\Tabs; use yii\helpers\Html; use kartik\grid\GridView; use yii\helpers\Url; use yii\bootstrap\Dropdown; use yii\web\JsExpression; ?> <div class="customer-prospect-report"> <h1> Customer Prospect Report </h1> <?php View::registerCssFile('@web/css/bootsnip-timeline.css'); echo Tabs::widget(['items' => [['label' => '<span class="glyphicon glyphicon-stats"></span>', 'encode' => false, 'content' => $this->render('prospect_chart', ['charts' => $charts]), 'active' => true], ['label' => '<span class="glyphicon glyphicon-search"></span>', 'encode' => false, 'content' => $this->render('_search', ['model' => $salesActivityForm])]]]); ?> <div class="grid-executive-summary"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">Followed Projects</h3> </div>
/** * load needed resources files */ public function loadResources(\yii\web\View $view) { $view->registerJsFile('@web/resources/tour/bootstrap-tour.min.js'); $view->registerCssFile('@web/resources/tour/bootstrap-tour.min.css'); }
/** * Registers the CSS and JS files with the given view. * @param \yii\web\View $view the view that the asset files are to be registered with. */ public function registerAssetFiles($view) { foreach ($this->js as $js) { if ($js[0] !== '/' && $js[0] !== '.' && strpos($js, '://') === false) { $view->registerJsFile($this->baseUrl . '/' . $js, [], $this->jsOptions); } else { $view->registerJsFile($js, [], $this->jsOptions); } } foreach ($this->css as $css) { if ($css[0] !== '/' && $css[0] !== '.' && strpos($css, '://') === false) { $view->registerCssFile($this->baseUrl . '/' . $css, [], $this->cssOptions); } else { $view->registerCssFile($css, [], $this->cssOptions); } } }
/** * @inheritdoc */ public function registerCssFile($url, $options = array(), $key = null) { parent::registerCssFile($this->addCacheBustQuery($url), $options, $key); }
foreach ($modelGroup as $groupSales) { $items[] = ['label' => $groupSales['name'], 'url' => ['', 'group' => $groupSales['id'], 'year' => $year]]; } echo Dropdown::widget(['items' => $items]); ?> </span> IN <span id="tahunCreateTitle" class="dropdown"> <a href="#" data-toggle="dropdown" class="dropdown-toggle"><?php echo Html::encode($year); ?> </a> <?php $start = 2014; $end = date('Y'); $items = []; for ($iYear = $start; $iYear <= $end; $iYear++) { $items[] = ['label' => $iYear, 'url' => ['', 'group' => $group_active, 'year' => $iYear]]; } echo Dropdown::widget(['items' => $items]); ?> </span> </h3> <?php // View::registerCssFile('@web/css/bootsnip-timeline.css'); View::registerCssFile('@web/css/moTimeline.css', ['depends' => [BootstrapAsset::className()]]); echo Tabs::widget(['items' => [['label' => '<span class="glyphicon glyphicon-tasks"></span>', 'encode' => false, 'content' => $this->render('timeline2', ['dataProvider' => $dataProvider]), 'active' => true], ['label' => '<span class="glyphicon glyphicon-stats"></span>', 'encode' => false, 'content' => $this->render('charts', ['charts' => $charts, 'series' => $series])], ['label' => '<span class="glyphicon glyphicon-search"></span>', 'encode' => false, 'content' => $this->render('_search', ['model' => $salesActivityForm])]]]); ?>
/** * @inheritdoc */ public function registerCssFile($url, $options = [], $key = null) { $this->viewElementsGathener->gather(__FUNCTION__, func_get_args()); return parent::registerCssFile($url, $options, $key); }
/** * @inheritdoc */ public function registerCssFile($url, $options = [], $key = null) { $key = $key ?: $url; $this->_cssFileURLs[$key] = $url; parent::registerCssFile($url, $options, $key); }
/** * @param \yii\web\View $view */ public static function noConflict($view) { //list(, $url) = \Yii::$app->assetManager->publish('@im/elfinder/assets'); list(, $url) = \Yii::$app->assetManager->publish('@app/modules/elfinder/src/assets'); //$view->registerJsFile($url . '/js/no.conflict.js', ['depends' => [JqueryAsset::className()]]); $view->registerCssFile($url . '/css/no.conflict.css'); }