Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.61 KB | None | 0 0
  1. =====================================================================
  2. ShareAsset.php <= this is located inside "{module}/assets/" directory
  3. =====================================================================
  4. <?php
  5.  
  6. namespace core\modules\share\assets;
  7. use yii\web\AssetBundle;
  8.  
  9. class ShareAsset extends AssetBundle
  10. {
  11.     public $sourcePath = '@core/modules/share/views/share';
  12.  
  13.     public $css = [
  14.         'css/share.css',
  15.         'css/vendor/stepper.css',
  16.         'css/vendor/bootstrap-select.css'
  17.     ];
  18.     public $js = [
  19.         'js/share.js',
  20.         'js/vendor/stepper.js',
  21.         'js/vendor/bootstrap-select.min.js',
  22.         '@vendor/almasaeed2010/adminlte/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.js'
  23.     ];
  24.     public $depends = [
  25.         'yii\web\YiiAsset',
  26.         'yii\bootstrap\BootstrapAsset',
  27.     ];
  28.     public function init()
  29.     {
  30.         $this->publishOptions['forceCopy'] = true;
  31.     }
  32. }
  33.  
  34. ==========================================================
  35. Share.php <= This is located inside the root of my module
  36. ==========================================================
  37. <?php
  38.  
  39. namespace core\modules\share;
  40.  
  41. use Yii;
  42. use core\modules\share\assets\ShareAsset;
  43.  
  44. /**
  45.  * share module definition class
  46.  */
  47. class Share extends \yii\base\Module
  48. {
  49.     /**
  50.      * {@inheritdoc}
  51.      */
  52.     public $controllerNamespace = 'core\modules\share\controllers';
  53.  
  54.     /**
  55.      * {@inheritdoc}
  56.      */
  57.     public function init()
  58.     {
  59.         parent::init();
  60.         ShareAsset::register(Yii::$app->view);
  61.  
  62.         // custom initialization code goes here
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement