HumHub Documentation (unofficial)

FileInputAsset extends BaseAsset
in package

Asset bundle for FileInput Widget

Tags
author

Kartik Visweswaran kartikv2@gmail.com

since
1.0

Table of Contents

Constants

EMPTY_ASSET  = 'N0/@$$3T$'
Unique value to set an empty asset via Yii AssetManager configuration.
EMPTY_PATH  = 'N0/P@T#'
Unique value to set an empty asset file path via Yii AssetManager configuration.
KRAJEE_ASSET  = 'K3/@$$3T$'
Unique value identifying a Krajee asset
KRAJEE_PATH  = 'K3/P@T#'
Unique value identifying a Krajee asset file path

Properties

$basePath  : string
$baseUrl  : string
$bsColCssPrefixes  : array<string|int, mixed>
$bsCssMap  : array<string|int, mixed>
$bsDependencyEnabled  : bool
$bsPluginEnabled  : bool
$bsVersion  : int|string
$css  : array<string|int, mixed>
$cssOptions  : array<string|int, mixed>
$depends  : mixed
$js  : array<string|int, mixed>
$jsOptions  : array<string|int, mixed>
$publishOptions  : array<string|int, mixed>
$sourcePath  : mixed
$_bsVer  : int
$_defaultBtnCss  : string
$_defaultIconPrefix  : string
$_isBs4  : bool

Methods

__call()  : mixed
Calls the named method which is not a class method.
__construct()  : mixed
Constructor.
__get()  : mixed
Returns the value of an object property.
__isset()  : bool
Checks if a property is set, i.e. defined and not null.
__set()  : mixed
Sets value of an object property.
__unset()  : mixed
Sets an object property to null.
addCssClass()  : Widget|mixed
Adds bootstrap CSS class to options by parsing the bootstrap version for the specified Bootstrap CSS type.
addLanguage()  : AssetBundle
Adds a language JS locale file
canGetProperty()  : bool
Returns a value indicating whether a property can be read.
canSetProperty()  : bool
Returns a value indicating whether a property can be set.
className()  : string
Returns the fully qualified name of this class.
getBSClass()  : mixed
Gets the respective Bootstrap class based on currently configured bootstrap version.
getBsVer()  : int
Gets the current set bootstrap version number.
getCssClass()  : string
Gets bootstrap css class by parsing the bootstrap version for the specified BS CSS type.
getDefaultBtnCss()  : string
Gets the default button CSS
getDefaultIconPrefix()  : string
Gets the default icon css prefix
getDropdownClass()  : string
Gets the respective bootstrap dropdown class name based on currently configured bootstrap version.
hasMethod()  : bool
Returns a value indicating whether a method is defined.
hasProperty()  : bool
Returns a value indicating whether a property is defined.
init()  : mixed
Initializes the bundle.
isBs()  : bool
Validate Bootstrap version
isBs4()  : bool
Validate if Bootstrap 4.x version.
publish()  : mixed
Publishes the asset bundle if its source code is not under Web-accessible directory.
register()  : static
Registers this asset bundle with a view.
registerAssetFiles()  : mixed
Registers the CSS and JS files with the given view.
registerBundle()  : static
Registers this asset bundle with a view after validating the bootstrap version
removeCssClass()  : Widget|mixed
Removes bootstrap CSS class from options by parsing the bootstrap version for the specified Bootstrap CSS type.
addDependency()  : mixed
Adds asset bundle dependency
configureBsVersion()  : int
Configures the bootstrap version settings
getBsExtBasename()  : string
The yii2-bootstrap extension base name.
initBsAssets()  : mixed
Initialize bootstrap assets dependencies
initBsVersion()  : mixed
Initializes bootstrap versions for the widgets and asset bundles.
isSameVersion()  : bool
Compares two versions and checks if they are of the same major BS version.
parseVer()  : int
Parses and returns the major BS version
setSourcePath()  : mixed
Sets the source path if empty
setupAssets()  : mixed
Set up CSS and JS asset arrays based on the base-file names

Constants

EMPTY_ASSET

Unique value to set an empty asset via Yii AssetManager configuration.

public mixed EMPTY_ASSET = 'N0/@$$3T$'

EMPTY_PATH

Unique value to set an empty asset file path via Yii AssetManager configuration.

public mixed EMPTY_PATH = 'N0/P@T#'

KRAJEE_ASSET

Unique value identifying a Krajee asset

public mixed KRAJEE_ASSET = 'K3/@$$3T$'

KRAJEE_PATH

Unique value identifying a Krajee asset file path

public mixed KRAJEE_PATH = 'K3/P@T#'

Properties

$basePath

public string $basePath

the Web-accessible directory that contains the asset files in this bundle.

If [[sourcePath]] is set, this property will be overwritten by [[AssetManager]] when it publishes the asset files from [[sourcePath]].

You can use either a directory or an alias of the directory.

$baseUrl

public string $baseUrl

the base URL for the relative asset files listed in [[js]] and [[css]].

If [[sourcePath]] is set, this property will be overwritten by [[AssetManager]] when it publishes the asset files from [[sourcePath]].

You can use either a URL or an alias of the URL.

$bsColCssPrefixes

public array<string|int, mixed> $bsColCssPrefixes = []

the bootstrap grid column css prefixes mapping, the key is the bootstrap versions, and the value is an array containing the sizes and their corresponding grid column css prefixes. The class using this trait, must implement BootstrapInterface. If not set will default to:

[
    3 => [
        self::SIZE_X_SMALL => 'col-xs-',
        self::SIZE_SMALL => 'col-sm-',
        self::SIZE_MEDIUM => 'col-md-',
        self::SIZE_LARGE => 'col-lg-',
        self::SIZE_X_LARGE => 'col-lg-',
    ],
    4 => [
        self::SIZE_X_SMALL => 'col-',
        self::SIZE_SMALL => 'col-sm-',
        self::SIZE_MEDIUM => 'col-md-',
        self::SIZE_LARGE => 'col-lg-',
        self::SIZE_X_LARGE => 'col-xl-',
    ],
    5 => [
        self::SIZE_X_SMALL => 'col-',
        self::SIZE_SMALL => 'col-sm-',
        self::SIZE_MEDIUM => 'col-md-',
        self::SIZE_LARGE => 'col-lg-',
        self::SIZE_X_LARGE => 'col-xl-',
    ],
];

$bsCssMap

public static array<string|int, mixed> $bsCssMap = [self::BS_SR_ONLY => ['sr-only', 'sr-only', 'visually-hidden'], self::BS_PANEL => ['panel', 'card'], self::BS_PANEL_HEADING => ['panel-heading', 'card-header'], self::BS_PANEL_TITLE => ['panel-title', 'card-title'], self::BS_PANEL_BODY => ['panel-body', 'card-body'], self::BS_PANEL_FOOTER => ['panel-footer', 'card-footer'], self::BS_PANEL_DEFAULT => ['panel-default', ['bg-light', 'text-dark']], self::BS_PANEL_DARK => ['panel-default', ['bg-dark', 'text-white']], self::BS_PANEL_SECONDARY => ['panel-default', ['bg-secondary', 'text-white']], self::BS_PANEL_PRIMARY => ['panel-primary', ['bg-primary', 'text-white']], self::BS_PANEL_SUCCESS => ['panel-success', ['bg-success', 'text-white']], self::BS_PANEL_INFO => ['panel-info', ['bg-info', 'text-dark']], self::BS_PANEL_WARNING => ['panel-warning', ['bg-warning', 'text-dark']], self::BS_PANEL_DANGER => ['panel-danger', ['bg-danger', 'text-white']], self::BS_LABEL => ['label', 'badge'], self::BS_BADGE => ['badge', ['badge', 'badge-pill'], ['badge', 'rounded-pill']], self::BS_LABEL_DEFAULT => ['label-default', 'badge-secondary', 'bg-secondary'], self::BS_LABEL_LIGHT => ['label-default', ['bg-light', 'text-dark']], self::BS_LABEL_DARK => ['label-default', ['bg-dark', 'text-white']], self::BS_LABEL_PRIMARY => ['label-primary', 'badge-primary', 'bg-primary'], self::BS_LABEL_SUCCESS => ['label-success', 'badge-success', 'bg-success'], self::BS_LABEL_INFO => ['label-info', 'badge-info', ['bg-info', 'text-dark']], self::BS_LABEL_WARNING => ['label-warning', 'badge-warning', ['bg-warning', 'text-dark']], self::BS_LABEL_DANGER => ['label-danger', 'badge-danger', 'bg-danger'], self::BS_TABLE_ACTIVE => ['default', 'table-active'], self::BS_TABLE_PRIMARY => ['primary', 'table-primary'], self::BS_TABLE_SUCCESS => ['success', 'table-success'], self::BS_TABLE_INFO => ['info', 'table-info'], self::BS_TABLE_WARNING => ['warning', 'table-warning'], self::BS_TABLE_DANGER => ['danger', 'table-danger'], self::BS_PROGRESS_BAR_ACTIVE => ['active', 'progress-bar-animated'], self::BS_PROGRESS_BAR_PRIMARY => ['progress-bar-primary', 'bg-primary'], self::BS_PROGRESS_BAR_SUCCESS => ['progress-bar-success', 'bg-success'], self::BS_PROGRESS_BAR_INFO => ['progress-bar-info', 'bg-info'], self::BS_PROGRESS_BAR_WARNING => ['progress-bar-warning', 'bg-warning'], self::BS_PROGRESS_BAR_DANGER => ['progress-bar-danger', 'bg-danger'], self::BS_WELL => ['well', ['card', 'card-body']], self::BS_WELL_SM => ['well-sm', ['card', 'card-body', 'p-2']], self::BS_WELL_LG => ['well-lg', ['card', 'card-body', 'p-4']], self::BS_THUMBNAIL => ['thumbnail', ['card', 'card-body']], self::BS_NAVBAR_DEFAULT => ['navbar-default', 'navbar-light'], self::BS_NAVBAR_TOGGLE => ['navbar-toggle', 'navbar-toggler'], self::BS_NAVBAR_RIGHT => ['navbar-right', 'ml-auto'], self::BS_NAVBAR_BTN => ['navbar-btn', 'nav-item'], self::BS_NAVBAR_FIXTOP => ['navbar-fixed-top', 'fixed-top'], self::BS_NAV_STACKED => ['nav-stacked', 'flex-column'], self::BS_NAV_ITEM => ['', 'nav-item'], self::BS_NAV_LINK => ['', 'nav-link'], self::BS_PAGE_ITEM => ['', 'page-item'], self::BS_PAGE_LINK => ['', 'page-link'], self::BS_LIST_INLINE_ITEM => ['', 'list-inline-item'], self::BS_BTN_DEFAULT => ['btn-default', 'btn-secondary'], self::BS_IMG_RESPONSIVE => ['img-responsive', 'img-fluid'], self::BS_IMG_CIRCLE => ['img-circle', 'rounded-circle'], self::BS_IMG_ROUNDED => ['img-rounded', 'rounded'], self::BS_RADIO => ['radio', 'form-check'], self::BS_CHECKBOX => ['checkbox', 'form-check'], self::BS_INPUT_LG => ['input-lg', 'form-control-lg'], self::BS_INPUT_SM => ['input-sm', 'form-control-sm'], self::BS_CONTROL_LABEL => ['control-label', 'col-form-label'], self::BS_TABLE_CONDENSED => ['table-condensed', 'table-sm'], self::BS_CAROUSEL_ITEM => ['item', 'carousel-item'], self::BS_CAROUSEL_ITEM_NEXT => ['next', 'carousel-item-next'], self::BS_CAROUSEL_ITEM_PREV => ['prev', 'carousel-item-prev'], self::BS_CAROUSEL_ITEM_LEFT => ['left', 'carousel-item-left'], self::BS_CAROUSEL_ITEM_RIGHT => ['right', 'carousel-item-right'], self::BS_CAROUSEL_CONTROL_LEFT => [['carousel-control', 'left'], 'carousel-control-left'], self::BS_CAROUSEL_CONTROL_RIGHT => [['carousel-control', 'right'], 'carousel-control-right'], self::BS_HELP_BLOCK => ['help-block', 'form-text'], self::BS_PULL_RIGHT => ['pull-right', 'float-right', 'float-end'], self::BS_PULL_LEFT => ['pull-left', 'float-left', 'float-start'], self::BS_CENTER_BLOCK => ['center-block', ['mx-auto', 'd-block']], self::BS_HIDE => ['hide', 'd-none'], self::BS_HIDDEN_PRINT => ['hidden-print', 'd-print-none'], self::BS_HIDDEN_XS => ['hidden-xs', ['d-none', 'd-sm-block']], self::BS_HIDDEN_SM => ['hidden-sm', ['d-sm-none', 'd-md-block']], self::BS_HIDDEN_MD => ['hidden-md', ['d-md-none', 'd-lg-block']], self::BS_HIDDEN_LG => ['hidden-lg', ['d-lg-none', 'd-xl-block']], self::BS_VISIBLE_PRINT => ['visible-print-block', ['d-print-block', 'd-none']], self::BS_VISIBLE_XS => ['visible-xs', ['d-block', 'd-sm-none']], self::BS_VISIBLE_SM => ['visible-sm', ['d-none', 'd-sm-block', 'd-md-none']], self::BS_VISIBLE_MD => ['visible-md', ['d-none', 'd-md-block', 'd-lg-none']], self::BS_VISIBLE_LG => ['visible-md', ['d-none', 'd-lg-block', 'd-xl-none']], self::BS_FORM_CONTROL_STATIC => ['form-control-static', 'form-control-plaintext'], self::BS_DROPDOWN_DIVIDER => ['divider', 'dropdown-divider'], self::BS_SHOW => ['in', 'show']]

CSS conversion mappings across bootstrap library versions.

This is set as $key => $value pairs where:

  • $key: string, is the style type to be configured (one of the constants starting with BS_)
  • $value: array, consists of 3 rows / items, each of which can be setup either as string (single CSS class) or an array (multiple CSS classes). Each of the row items indicate the following:
    • the first item represents the CSS class(es) for Bootstrap 3.x.
    • the second item represents the CSS class(es) for Bootstrap 4.x
    • the third item represents the CSS class(es) for Bootstrap 5.x (if it does not exist will use bootstrap 4.x setting)

$bsDependencyEnabled

public bool $bsDependencyEnabled

whether to enable the dependency with yii2 bootstrap asset bundle (depending on [[bsVersion]])

$bsPluginEnabled

public bool $bsPluginEnabled = false

whether the bootstrap JS plugins are to be loaded and enabled

$bsVersion

public int|string $bsVersion

the bootstrap library version that you wish to use for this specific extension / widget.

  • To use with bootstrap 3 - you can set this to any string starting with 3 (e.g. 3 or 3.3.7 or 3.x)
  • To use with bootstrap 4 - you can set this to any string starting with 4 (e.g. 4 or 4.6.0 or 4.x)
  • To use with bootstrap 5 - you can set this to any string starting with 5 (e.g. 5 or 5.1.0 or 5.x)

This property can be set up globally in Yii application params in your Yii2 application config file.

For example:

'params' = [
    'bsVersion' => '5.x' // will enable Bootstrap 5.x globally
]

Note that if this property is set as part of this extension class, then the extension setting will override the Yii::$app->params['bsVersion']. This property will default to 3.x (Bootstrap 3.x version) if it is not set anywhere (extension or module or Yii params).

$css

public array<string|int, mixed> $css = self::KRAJEE_ASSET

list of CSS files that this bundle contains. Each CSS file can be specified in one of the three formats as explained in [[js]].

Note that only a forward slash "/" should be used as directory separator.

Tags
inheritdoc

$cssOptions

public array<string|int, mixed> $cssOptions = []

the options that will be passed to [[View::registerCssFile()]] when registering the CSS files in this bundle.

$depends

public mixed $depends = ['yii\web\YiiAsset']
Tags
inheritdoc

$js

public array<string|int, mixed> $js = self::KRAJEE_ASSET

list of JavaScript files that this bundle contains. Each JavaScript file can be specified in one of the following formats:

  • an absolute URL representing an external asset. For example, https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js or //ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js.
  • a relative path representing a local asset (e.g. js/main.js). The actual file path of a local asset can be determined by prefixing [[basePath]] to the relative path, and the actual URL of the asset can be determined by prefixing [[baseUrl]] to the relative path.
  • an array, with the first entry being the URL or relative path as described before, and a list of key => value pairs that will be used to overwrite [[jsOptions]] settings for this entry. This functionality is available since version 2.0.7.

Note that only a forward slash "/" should be used as directory separator.

Tags
inheritdoc

$jsOptions

public array<string|int, mixed> $jsOptions = []

the options that will be passed to [[View::registerJsFile()]] when registering the JS files in this bundle.

$publishOptions

public array<string|int, mixed> $publishOptions = []

the options to be passed to [[AssetManager::publish()]] when the asset bundle is being published. This property is used only when [[sourcePath]] is set.

$sourcePath

public mixed $sourcePath = '@vendor/kartik-v/bootstrap-fileinput'
Tags
inheritdoc

$_defaultBtnCss

protected string $_defaultBtnCss

default bootstrap button CSS

$_defaultIconPrefix

protected string $_defaultIconPrefix

default icon CSS prefix

$_isBs4

protected bool $_isBs4

flag to detect whether bootstrap 4.x version is set

This property is deprecated since v3.0.0 and replaced by the more flexible [[_bsVer]] flag.

Tags
deprecated

since v3.0.0 and replaced by [[_bsVer]] flag

Methods

__call()

Calls the named method which is not a class method.

public __call(string $name, array<string|int, mixed> $params) : mixed

Do not call this method directly as it is a PHP magic method that will be implicitly called when an unknown method is being invoked.

Parameters
$name : string

the method name

$params : array<string|int, mixed>

method parameters

Tags
throws
UnknownMethodException

when calling unknown method

Return values
mixed

the method return value

__construct()

Constructor.

public __construct([array<string|int, mixed> $config = [] ]) : mixed

The default implementation does two things:

  • Initializes the object with the given configuration $config.
  • Call [[init()]].

If this method is overridden in a child class, it is recommended that

  • the last parameter of the constructor is a configuration array, like $config here.
  • call the parent implementation at the end of the constructor.
Parameters
$config : array<string|int, mixed> = []

name-value pairs that will be used to initialize the object properties

__get()

Returns the value of an object property.

public __get(string $name) : mixed

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $value = $object->property;.

Parameters
$name : string

the property name

Tags
throws
UnknownPropertyException

if the property is not defined

throws
InvalidCallException

if the property is write-only

see
__set()
Return values
mixed

the property value

__isset()

Checks if a property is set, i.e. defined and not null.

public __isset(string $name) : bool

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing isset($object->property).

Note that if the property is not defined, false will be returned.

Parameters
$name : string

the property name or the event name

Tags
see
https://www.php.net/manual/en/function.isset.php
Return values
bool

whether the named property is set (not null).

__set()

Sets value of an object property.

public __set(string $name, mixed $value) : mixed

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing $object->property = $value;.

Parameters
$name : string

the property name or the event name

$value : mixed

the property value

Tags
throws
UnknownPropertyException

if the property is not defined

throws
InvalidCallException

if the property is read-only

see
__get()

__unset()

Sets an object property to null.

public __unset(string $name) : mixed

Do not call this method directly as it is a PHP magic method that will be implicitly called when executing unset($object->property).

Note that if the property is not defined, this method will do nothing. If the property is read-only, it will throw an exception.

Parameters
$name : string

the property name

Tags
throws
InvalidCallException

if the property is read only.

see
https://www.php.net/manual/en/function.unset.php

addCssClass()

Adds bootstrap CSS class to options by parsing the bootstrap version for the specified Bootstrap CSS type.

public addCssClass(array<string|int, mixed> &$options, string $type) : Widget|mixed
Parameters
$options : array<string|int, mixed>

the HTML attributes for the container element that will be modified

$type : string

the bootstrap CSS class type

Tags
throws
Exception
Return values
Widget|mixed

current object instance that uses this trait

addLanguage()

Adds a language JS locale file

public addLanguage([string $lang = '' ][, string $prefix = '' ][, string $dir = null ][, bool $min = false ]) : AssetBundle
Parameters
$lang : string = ''

the ISO language code

$prefix : string = ''

the language locale file name prefix

$dir : string = null

the language file directory relative to source path

$min : bool = false

whether to auto use minified version

Return values
AssetBundle

instance

canGetProperty()

Returns a value indicating whether a property can be read.

public canGetProperty(string $name[, bool $checkVars = true ]) : bool

A property is readable if:

  • the class has a getter method associated with the specified name (in this case, property name is case-insensitive);
  • the class has a member variable with the specified name (when $checkVars is true);
Parameters
$name : string

the property name

$checkVars : bool = true

whether to treat member variables as properties

Tags
see
canSetProperty()
Return values
bool

whether the property can be read

canSetProperty()

Returns a value indicating whether a property can be set.

public canSetProperty(string $name[, bool $checkVars = true ]) : bool

A property is writable if:

  • the class has a setter method associated with the specified name (in this case, property name is case-insensitive);
  • the class has a member variable with the specified name (when $checkVars is true);
Parameters
$name : string

the property name

$checkVars : bool = true

whether to treat member variables as properties

Tags
see
canGetProperty()
Return values
bool

whether the property can be written

className()

Returns the fully qualified name of this class.

public static className() : string
Tags
deprecated

since 2.0.14. On PHP >=5.5, use ::class instead.

Return values
string

the fully qualified name of this class.

getBSClass()

Gets the respective Bootstrap class based on currently configured bootstrap version.

public getBSClass(mixed $className) : mixed
Parameters
$className : mixed
Tags
throws
InvalidConfigException

getBsVer()

Gets the current set bootstrap version number.

public getBsVer() : int
Tags
throws
Exception
Return values
int

getCssClass()

Gets bootstrap css class by parsing the bootstrap version for the specified BS CSS type.

public getCssClass(string $type[, bool $asString = true ]) : string
Parameters
$type : string

the bootstrap CSS class type

$asString : bool = true

whether to return classes as a string separated by space

Tags
throws
Exception
Return values
string

getDefaultBtnCss()

Gets the default button CSS

public getDefaultBtnCss() : string
Return values
string

getDefaultIconPrefix()

Gets the default icon css prefix

public getDefaultIconPrefix() : string
Return values
string

getDropdownClass()

Gets the respective bootstrap dropdown class name based on currently configured bootstrap version.

public getDropdownClass([bool $isBtn = false ]) : string
Parameters
$isBtn : bool = false

whether to get the Button Dropdown widget class

Tags
throws
InvalidConfigException
Return values
string

hasMethod()

Returns a value indicating whether a method is defined.

public hasMethod(string $name) : bool

The default implementation is a call to php function method_exists(). You may override this method when you implemented the php magic method __call().

Parameters
$name : string

the method name

Return values
bool

whether the method is defined

hasProperty()

Returns a value indicating whether a property is defined.

public hasProperty(string $name[, bool $checkVars = true ]) : bool

A property is defined if:

  • the class has a getter or setter method associated with the specified name (in this case, property name is case-insensitive);
  • the class has a member variable with the specified name (when $checkVars is true);
Parameters
$name : string

the property name

$checkVars : bool = true

whether to treat member variables as properties

Tags
see
canGetProperty()
see
canSetProperty()
Return values
bool

whether the property is defined

init()

Initializes the bundle.

public init() : mixed
Tags
inheritdoc

isBs()

Validate Bootstrap version

public isBs(int $ver) : bool
Parameters
$ver : int
Tags
throws
Exception
Return values
bool

isBs4()

Validate if Bootstrap 4.x version.

public isBs4() : bool

This property is deprecated since v3.0.0 and replaced by the [[isBs]] method.

Tags
deprecated

since v3.0.0 and replaced by the [[isBs]] method

throws
Exception
Return values
bool

publish()

Publishes the asset bundle if its source code is not under Web-accessible directory.

public publish(AssetManager $am) : mixed

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]].

Parameters
$am : AssetManager

the asset manager to perform the asset publishing

register()

Registers this asset bundle with a view.

public static register(View $view) : static
Parameters
$view : View

the view to be registered with

Return values
static

the registered asset bundle instance

registerAssetFiles()

Registers the CSS and JS files with the given view.

public registerAssetFiles(View $view) : mixed
Parameters
$view : View

the view that the asset files are to be registered with.

registerBundle()

Registers this asset bundle with a view after validating the bootstrap version

public static registerBundle(View $view[, string $bsVer = null ]) : static
Parameters
$view : View

the view to be registered with

$bsVer : string = null

the bootstrap version

Tags
throws
Exception
Return values
static

the registered asset bundle instance

removeCssClass()

Removes bootstrap CSS class from options by parsing the bootstrap version for the specified Bootstrap CSS type.

public removeCssClass(array<string|int, mixed> &$options, string $type) : Widget|mixed
Parameters
$options : array<string|int, mixed>

the HTML attributes for the container element that will be modified

$type : string

the bootstrap CSS class type

Tags
throws
Exception
Return values
Widget|mixed

current object instance that uses this trait

addDependency()

Adds asset bundle dependency

protected addDependency(string $lib) : mixed
Parameters
$lib : string

configureBsVersion()

Configures the bootstrap version settings

protected configureBsVersion() : int
Tags
throws
Exception
Return values
int

the bootstrap lib parsed version number (defaults to 3)

getBsExtBasename()

The yii2-bootstrap extension base name.

protected getBsExtBasename() : string

Based on the currently set bootstrap version (3, 4, or 5), returns one of bootstrap, bootstrap4 or bootstrap5.

Tags
throws
Exception
Return values
string

initBsAssets()

Initialize bootstrap assets dependencies

protected initBsAssets() : mixed

initBsVersion()

Initializes bootstrap versions for the widgets and asset bundles.

protected initBsVersion() : mixed

Sets the [[_bsVer]] flag by parsing [[bsVersion]].

Tags
throws
InvalidConfigException

isSameVersion()

Compares two versions and checks if they are of the same major BS version.

protected static isSameVersion(int|string $ver1, int|string $ver2) : bool
Parameters
$ver1 : int|string

first version

$ver2 : int|string

second version

Return values
bool

whether major versions are equal

parseVer()

Parses and returns the major BS version

protected static parseVer(string $ver) : int
Parameters
$ver : string
Return values
int

setSourcePath()

Sets the source path if empty

protected setSourcePath(string $path) : mixed
Parameters
$path : string

the path to be set

setupAssets()

Set up CSS and JS asset arrays based on the base-file names

protected setupAssets(string $type[, array<string|int, mixed> $files = [] ]) : mixed
Parameters
$type : string

whether 'css' or 'js'

$files : array<string|int, mixed> = []

the list of 'css' or 'js' basefile names


        
On this page

Search results