Register new Assets.

@param  string|array $assets
@param  string $type
@param  string $position
@param  int $order
@param  string $mode

@return void
@throws \InvalidArgumentException
558536
public function register($assets, $type, $position, $order = 0, $mode = 'default')
    {
        if (! in_array($type, $this->types)) {
            throw new InvalidArgumentException("Invalid assets type [${type}]");
        } else if (! in_array($mode, array('default', 'inline', 'view'))) {
            throw new InvalidArgumentException("Invalid assets mode [${mode}]");
        }

        // The assets type and mode are valid.
        else if (! empty($items = $this->parseAssets($assets, $order, $mode))) {
            // We will merge the items for the specified type and position.

            Arr::set($this->positions, $key = "${type}.${position}", array_merge(
                Arr::get($this->positions, $key, array()), $items
            ));
        }
    }
1156262
private function registerAssets()
    {
        $al = AssetList::getInstance();
        $al->registerMultiple([
            'jquery/scroll-to' => [
                ['javascript', 'js/jquery.scrollTo.min.js', ['minify' => true, 'combine' => true, 'version' => '2.1.2'], $this],
            ],
            'community_translation/online_translation/bootstrap' => [
                ['javascript', 'js/bootstrap.min.js', ['minify' => false, 'combine' => true], $this],
            ],
            'community_translation/online_translation/markdown-it' => [
                ['javascript', 'js/markdown-it.min.js', ['minify' => false, 'combine' => true], $this],
            ],
            'community_translation/online_translation/core' => [
                ['css', 'css/online-translation.css', ['minify' => false, 'combine' => true], $this],
                ['javascript', 'js/online-translation.js', ['minify' => true, 'combine' => true], $this],
            ],
            'jquery/comtraSortable' => [
                ['css', 'css/jquery.comtraSortable.css', ['minify' => true, 'combine' => true], $this],
                ['javascript', 'js/jquery.comtraSortable.js', ['minify' => true, 'combine' => true], $this],
            ],
        ]);
        $al->registerGroupMultiple([
            'jquery/scroll-to' => [
                [
                    ['javascript', 'jquery'],
                    ['javascript', 'jquery/scroll-to'],
                ],
            ],
            'community_translation/online_translation' => [
                [
                    ['css', 'community_translation/online_translation/core'],
                    ['javascript', 'community_translation/online_translation/bootstrap'],
                    ['javascript', 'community_translation/online_translation/markdown-it'],
                    ['javascript', 'community_translation/online_translation/core'],
                ],
            ],
            'jquery/comtraSortable' => [
                [
                    ['css', 'font-awesome'],
                    ['css', 'jquery/comtraSortable'],
                    ['javascript', 'jquery/comtraSortable'],
                ],
            ],
        ]);
    }
224224
public function registerAssets()
    {
        $view = $this->getView();
        NotifyAsset::register($view);

        $config = [
            'type' => $this->type,
            'closable' => $this->closable,
            'transition' => $this->transition,
            'fadeOut' => $this->fadeOut,
            'message' => $this->message,
            'onClose' => new JsExpression($this->onClose),
            'onClosed' => new JsExpression($this->onClosed)
        ];
        $defaults = Json::encode($config);

        $js = <<<SCRIPT
;(function($, window, document, undefined) {
    $('.alert').toNotify({$defaults}, $('#talmaNotify')).show();
})(window.jQuery, window, document);
SCRIPT;
        $view->registerJs($js);
    }
1165461
public function autoload($assets)
    {
        foreach ($assets as $position => $collections) {
            if (property_exists($this, $position)) {

                if ($collections instanceof \ArrayObject) {
                    $collections = $collections->getArrayCopy();
                }

                $this->{$position}->loadCollections($collections);
            } elseif ($position === 'packages') {
                $this->loadPackages($collections);
            } elseif ($position === 'css') {
                $this->loadCss($collections);
            } elseif ($position === 'js') {
                $this->loadJs($collections);
            }
        }
    }
184905
public function register(string $type, $schema): void
    {
        if (empty($type) === true || \class_exists($type) === false) {
            throw new InvalidArgumentException(_(static::MSG_INVALID_MODEL_TYPE));
        }

        $isOk = (
            (
                \is_string($schema) === true &&
                empty($schema) === false &&
                \class_exists($schema) === true &&
                \in_array(SchemaInterface::class, \class_implements($schema)) === true
            ) ||
            \is_callable($schema) ||
            $schema instanceof SchemaInterface
        );
        if ($isOk === false) {
            throw new InvalidArgumentException(_(static::MSG_INVALID_SCHEME, $type));
        }

        if ($this->hasProviderMapping($type) === true) {
            throw new InvalidArgumentException(_(static::MSG_TYPE_REUSE_FORBIDDEN, $type));
        }

        if ($schema instanceof SchemaInterface) {
            $this->setProviderMapping($type, \get_class($schema));
            $this->setResourceToJsonTypeMapping($schema->getType(), $type);
            $this->setCreatedProvider($type, $schema);
        } else {
            $this->setProviderMapping($type, $schema);
        }
    }
975238
public static function createType($type)
    {
        if (!isset(static::$typeClasses[$type])) {
            throw new InvalidArgumentException('The asset type "'.$type.'" does not exist, only "'.implode('", "', static::getTypes()).'" are accepted');
        }

        $class = static::$typeClasses[$type];

        return new $class();
    }
733234
public function registerAssets()
    {
        $cs = Yii::app()->getClientScript();

        $path = __DIR__ . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'bootstrap-editable';
        $assetsUrl = $this->getAssetsUrl($path);

        $cs->registerScriptFile($assetsUrl . '/js/editable-setup.js', CClientScript::POS_BEGIN);

        //register assets
        $cs->registerCssFile($assetsUrl . '/css/bootstrap-editable.css');
        $cs->registerScriptFile($assetsUrl . '/js/bootstrap-editable.js', CClientScript::POS_END);

        //include moment.js for combodate
        if ($this->type == 'combodate') {
            $path = __DIR__ . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'moment';
            $momentUrl = Yii::app()->assetManager->publish($path, false, -1, $this->getApi()->forceCopyAssets);
            $cs->registerScriptFile($momentUrl . '/moment.min.js');
        }

        //include select2 lib for select2 type
        if ($this->type == 'select2') {
            $path = __DIR__ . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'select2';
            $select2Url = Yii::app()->assetManager->publish($path, false, -1, $this->getApi()->forceCopyAssets);
            $cs->registerScriptFile($select2Url . '/select2.min.js');
            $cs->registerCssFile($select2Url . '/select2.css');
        }

        //include bootstrap-datetimepicker
        if ($this->type == 'datetime') {
            $path = __DIR__ . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'bootstrap-datetimepicker';
            $dateTimePickerUrl = Yii::app()->assetManager->publish($path, false, -1, $this->getApi()->forceCopyAssets);
            $cs->registerScriptFile($dateTimePickerUrl . '/js/bootstrap-datetimepicker.js');
            $cs->registerCssFile($dateTimePickerUrl . '/css/datetimepicker.css');
        }
    }
387151
public function registerScriptFile($url, $position = null)
    {
        if (($cs = $this->getClientScript()) === false) {
            return null;
        }
        if (isset($this->_assetsUrl)) {
            $url = $this->_assetsUrl . '/' . ltrim($url, '/');
        }
        return $cs->registerScriptFile($url, $position);
    }
915832
public function createAction(Asset $asset): void
    {
        if ($this->persistenceManager->isNewObject($asset)) {
            $this->assetRepository->add($asset);
        }
        $this->addFlashMessage('assetHasBeenAdded', '', Message::SEVERITY_OK, [htmlspecialchars($asset->getLabel())]);
        $this->redirect('index');
    }
410163
public function registerAssetJs($jsFile, $position = CClientScript::POS_END)
    {
        Yii::app()->getClientScript()->registerScriptFile($this->getAssetsUrl() . "/js/{$jsFile}", $position);
        return $this;
    }
1099849
function addFromArray($assets) {
        if (!is_array($assets)) $assets = [$assets];
        foreach ($assets as $key => $asset) {
            if ($key === 'debug') {
                if (self::$debug) $this->addFromArray($asset);
            } else if ($key === 'prod') {
                if (!self::$debug) $this->addFromArray($asset);
            } else {
                if (isset(self::$libs[$asset])) {
                    $this->addLib($asset);
                } elseif (substr($asset, -4) == '.css' || strpos($asset,'.css?v=') !== false) {
                    $this->addCss($asset);
                } else {
                    $this->addJs($asset);
                }
            }
        }
    }
398020
protected function registerAssets()
    {
        do_action("before_theme_register_assets");

        $assets = $this->getConfig("assets");

        add_action("wp_enqueue_scripts", function () use ($assets) {
            foreach ($assets as $id => $asset) :
                $file = strpos($asset["file"], "//") === false ? get_template_directory_uri() . "/public/" . $asset["file"] : $asset["file"];
                if ($asset["type"] == "js") :
                    wp_enqueue_script($id, $file, $asset["dependencies"], $asset["version"], $asset["footer"]);
                elseif ($asset["type"] == "css") :
                    wp_enqueue_style($id, $file, $asset["dependencies"], $asset["version"], "all");
                endif;
            endforeach;
        });

        do_action("after_theme_register_assets");
    }
118772
public function registerAssetFiles( $view ) {

		parent::registerAssetFiles( $view );

		// FB App Id
		$appId = FacebookProperties::getInstance()->getAppId();

		// FB SDK Script
		$script = "
			window.fbAsyncInit = function() {
			  FB.init({
				appId            : '$appId',
				autoLogAppEvents : true,
				xfbml            : true,
				version          : 'v3.0'
			  });
			};

			(function(d, s, id){
			   var js, fjs = d.getElementsByTagName(s)[0];
			   if (d.getElementById(id)) {return;}
			   js = d.createElement(s); js.id = id;
			   js.src = \"https://connect.facebook.net/en_US/sdk.js\";
			   fjs.parentNode.insertBefore(js, fjs);
			 }(document, 'script', 'facebook-jssdk'));";

		$view->registerJs( $script, View::POS_HEAD );
	}
616673
public function asset_add_path($params) {
        if (!isset($params['path']))
            throw new \UnexpectedValueException('Asset path must be specified');
        $type = isset($params['type']) ? $params['type'] : null;
        Asset::add_path($params['path'], $type);
    }
755136
public function registerAsset($context, $asset)
    {
        return $this->resolveAndCall($asset, 'register', [
            isset($context['this']) ? $context['this'] : null,
        ]);
    }
48400
public function registerAssets()
    {
        $view = $this->getView();
        $asset = NotyAsset::register($view);
        $asset->animateCss = $this->registerAnimateCss;
        $asset->buttonsCss = $this->registerButtonsCss;
        $asset->fontAwesomeCss = $this->enableIcon && $this->registerFontAwesomeCss;
    }
445260
protected function registerAssets()
    {
        $view = $this->getView();
        SelectizeAsset::register($view);
        $js = '$("#' . $this->getInputId() . '").selectize(' . $this->getPluginOptions() . ');';
        $view->registerJs($js, $view::POS_END);
    }