当前位置: 首页>>代码示例>>PHP>>正文


PHP AssetBundle::publish方法代码示例

本文整理汇总了PHP中yii\web\AssetBundle::publish方法的典型用法代码示例。如果您正苦于以下问题:PHP AssetBundle::publish方法的具体用法?PHP AssetBundle::publish怎么用?PHP AssetBundle::publish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\web\AssetBundle的用法示例。


在下文中一共展示了AssetBundle::publish方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: publish

 public function publish($am)
 {
     parent::publish($am);
     $view = Yii::$app->getView();
     $language = Yii::$app->language;
     $view->registerJs("i18n.init({ lng: '{$language}', resGetPath: '/locales/__lng__/__ns__.json', fallbackLng: 'en' });");
 }
开发者ID:branchonline,项目名称:yii2-i18next,代码行数:7,代码来源:I18NextAsset.php

示例2: publish

    /**
     * @inheritdoc
     */
    public function publish($am)
    {
        parent::publish($am);
        $js = <<<JS
    emojione.imagePathPNG = '{$this->baseUrl}/assets/png/';
JS;
        \Yii::$app->view->registerJs($js);
    }
开发者ID:mervick,项目名称:yii2-emojionearea,代码行数:11,代码来源:EmojiOneAsset.php

示例3: initView

 public function initView($view)
 {
     $files = [pathinfo('@nitm/assets/js/jquery-plugins/jquery.ui.widget.js'), pathinfo('@nitm/assets/js/jquery-plugins/jquery-ui-scrollable/jquery-ui-scrollable.js')];
     foreach ($files as $f) {
         $asset = new \yii\web\AssetBundle(['sourcePath' => $f['dirname'], 'js' => [$f['basename']]]);
         $asset->publish($view->getAssetManager());
         $view->assetBundles[static::className() . '\\' . $f['basename']] = $asset;
     }
     return $this;
 }
开发者ID:nhatvuvan,项目名称:yii2-widgets,代码行数:10,代码来源:AjaxWidgetAsset.php

示例4: publish

 public function publish($assetManager)
 {
     $module = \bedezign\yii2\audit\Auditing::current();
     if ($module && $module->entry) {
         // We can't be sure that the actual logger was loaded already, so we fallback on the window object
         // to store the associated audit entry id
         \Yii::$app->view->registerJs("window.auditEntry = {$module->entry->id};", \yii\web\View::POS_HEAD);
     }
     return parent::publish($assetManager);
 }
开发者ID:cornernote,项目名称:yii2-audit,代码行数:10,代码来源:JSLoggingAsset.php

示例5: publish

    public function publish($am)
    {
        parent::publish($am);
        $jsSettings = ArrayHelper::merge([], static::$jsSettings);
        if ($jsSettings['uid']) {
            $jsSettings['uid'] = (int) $jsSettings['uid'];
        }
        $jsSettings = Json::encode($jsSettings);
        \Yii::$app->getView()->registerJs(<<<JS
    wamp.init({$jsSettings});
JS
);
    }
开发者ID:vitprog,项目名称:yii2-wamp-server,代码行数:13,代码来源:Asset.php

示例6: publish

 /**
  * @param \yii\web\AssetManager $assetManager
  */
 public function publish($assetManager)
 {
     $module = Audit::getInstance();
     // We can't be sure that the actual logger was loaded already, so we fallback on the window object
     // to store the associated audit url and entry id
     $url = Url::to(["/{$module->id}/js-log"]);
     $script = "window.auditUrl = '{$url}';";
     if ($module->entry) {
         $id = $module->getEntry()->id;
         $script .= "window.auditEntry = {$id};";
     }
     \Yii::$app->view->registerJs($script, View::POS_HEAD);
     parent::publish($assetManager);
 }
开发者ID:SaschaScholly,项目名称:yii2-audit,代码行数:17,代码来源:JSLoggingAsset.php

示例7: publish

 /**
  * Publishes the asset bundle if its source code is not under Web-accessible directory.
  * It will also try to convert non-CSS or JS files (e.g. LESS, Sass) into the corresponding
  * CSS or JS files using [[AssetManager::converter|asset converter]].
  * 
  * This method set [[AssetManager::linkAssets]] value to false before publishing
  * and restore it after.
  * 
  * @param AssetManager $am the asset manager to perform the asset publishing
  */
 public function publish($am)
 {
     if (!count($this->allowedDirectories)) {
         return parent::publish($am);
     }
     $oldLinkAssets = $am->linkAssets;
     $am->linkAssets = false;
     try {
         $this->publishOptions['beforeCopy'] = \Yii::createObject(array('class' => AssetDirectoriesFilter::className(), 'assetManager' => $am, 'assetBundle' => $this));
         $result = parent::publish($am);
     } catch (\Exception $ex) {
         $am->linkAssets = $oldLinkAssets;
         throw $ex;
     }
     $am->linkAssets = $oldLinkAssets;
     return $result;
 }
开发者ID:alex-dwt,项目名称:file,代码行数:27,代码来源:AssetBundle.php

示例8: publish

 public function publish($am)
 {
     $this->configureFromClass();
     return parent::publish($am);
 }
开发者ID:execut,项目名称:yii2-base,代码行数:5,代码来源:AssetBundle.php

示例9: publish

 public function publish($am)
 {
     parent::publish($am);
     $this->css = $this->addLastModifiedParam($this->css);
     $this->js = $this->addLastModifiedParam($this->js);
 }
开发者ID:vsguts,项目名称:crm,代码行数:6,代码来源:AppAsset.php


注:本文中的yii\web\AssetBundle::publish方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。