Skip to content
PHP Ecosystem
Explore

Select2Asset

API reference › Select2 › Select2Asset

final classYii2\Extensions\Select2\Select2Asset
Extendsyii\web\AssetBundle » yii\base\BaseObject
Implementsyii\base\Configurable
Sourcesrc/Select2Asset.php

Publishes Select2’s full browser build and the translation matching the application language.

PropertyTypeDescriptionDefined by
$basePathstring|nullThe Web-accessible directory that contains the asset files in this bundle. Default: null.yii\web\AssetBundle
$baseUrlstring|nullThe base URL for the relative asset files listed in $js and $css. Default: null.yii\web\AssetBundle
$cssDefault Select2 stylesheet. Default: ['css/select2.min.css'].Select2Asset
$cssOptionsyii\web\RegisterCssFileOptionsThe options that will be passed to View::registerCssFile() when registering the CSS files in this bundle. Default: [].yii\web\AssetBundle
$dependsJQuery, required by Select2. Default: [\yii\web\JqueryAsset::class].Select2Asset
$jsFull Select2 build; publish() appends the matching translation. Default: ['js/select2.full.min.js'].Select2Asset
$jsOptionsyii\web\RegisterJsFileOptionsThe options that will be passed to View::registerJsFile() when registering the JS files in this bundle. Default: [].yii\web\AssetBundle
$publishOptionsyii\web\PublishOptionsThe options to be passed to AssetManager::publish() when the asset bundle is being published. Default: [].yii\web\AssetBundle
$sourcePathPublished distribution directory of the Select2 npm package. Default: '@npm/select2/dist'.Select2Asset
MethodDescriptionDefined by
__construct()Constructor.yii\base\BaseObject
__call()Calls the named method which is not a class method.yii\base\BaseObject
__get()Returns the value of an object property.yii\base\BaseObject
__isset()Checks if a property is set, i.e. defined and not null.yii\base\BaseObject
__set()Sets value of an object property.yii\base\BaseObject
__unset()Sets an object property to null.yii\base\BaseObject
canGetProperty()Returns a value indicating whether a property can be read.yii\base\BaseObject
canSetProperty()Returns a value indicating whether a property can be set.yii\base\BaseObject
className() staticReturns the fully qualified name of this class.yii\base\BaseObject
hasMethod()Returns a value indicating whether a method is defined.yii\base\BaseObject
hasProperty()Returns a value indicating whether a property is defined.yii\base\BaseObject
init()Initializes the bundle.yii\web\AssetBundle
publish()Publishes the bundle and appends the exact regional translation, or else its base-language translation.Select2Asset
register() staticRegisters this asset bundle with a view.yii\web\AssetBundle
registerAssetFiles()Registers the CSS and JS files with the given view.yii\web\AssetBundle
public function publish(yii\web\AssetManager $am): void

Publishes the bundle and appends the exact regional translation, or else its base-language translation.

Parameters

ParameterTypeDescription
$amyii\web\AssetManagerAsset manager that publishes the bundle.