yii\web\AssetBundle::register PHP Method

register() public static method

Registers this asset bundle with a view.
public static register ( View $view ) : static
$view View the view to be registered with
return static the registered asset bundle instance
    public static function register($view)
    {
        return $view->registerAssetBundle(get_called_class());
    }

Usage Example

Beispiel #1
0
 public static function register($view, $options = [])
 {
     parent::register($view);
     $callback = null;
     if (isset($options['callback'])) {
         $callback = $options['callback'];
     }
     $settings = $options + self::_getDefaultOptions();
     unset($options);
     if ($settings['text'] == '' && is_array($settings['type'])) {
         foreach ($settings['type'] as $type) {
             $new_settings = $settings;
             $new_settings['type'] = $type;
             $new_settings['text'] = \Yii::$app->session->getFlash($type);
             if (isset($new_settings['text']) && is_array($new_settings['text'])) {
                 foreach ($new_settings['text'] as $text) {
                     $multipleFlashesSettings = $new_settings;
                     $multipleFlashesSettings['text'] = $text;
                     $view->registerJs(self::_run($multipleFlashesSettings, $callback));
                 }
             } elseif (isset($new_settings['text'])) {
                 $view->registerJs(self::_run($new_settings, $callback));
             }
         }
     } else {
         $view->registerJs(self::_run($settings, $callback));
     }
 }
All Usage Examples Of yii\web\AssetBundle::register