PHP Class kartik\tree\TreeViewInput

Since: 1.0
Author: Kartik Visweswaran ([email protected])
Inheritance: extends TreeView
Show file Open project: kartik-v/yii2-tree-manager Class Usage Examples

Public Properties

Property Type Description
$asDropdown whether to show the input as a dropdown select. If set to false, it will display directly the tree view selector widget. Defaults to true. The BootstrapPluginAsset will automatically be loaded if this is set to true. Defaults to true.
$attribute the model attribute that this widget is associated with.
$autoCloseOnSelect whether to autoclose the dropdown on input selection when asDropdown is true. Defaults to true.
$dropdownConfig the configuration of the tree view dropdown. The following configuration options are available: - input: array the HTML attributes for the dropdown input container which displays the selected tree items. The following special options are available: - placeholder: string, defaults to Select... - dropdown: array, the HTML attributes for the dropdown tree view menu. - options: array, the HTML attributes for the wrapper container - caret: string, the markup for rendering the dropdown indicator for up and down. Defaults to TreeViewInput::CARET.
$model the data model that this widget is associated with.
$name the input name. This must be set if [[model]] and [[attribute]] are not set.
$options the HTML attributes for the input that will store the selected nodes for the widget
$showToolbar whether to show the toolbar in the footer. Defaults to false.
$value the input value.

Public Methods

Method Description
getInput ( ) : string Generates the hidden input for storage
registerInputAssets ( ) Registers assets for TreeViewInput
renderToolbar ( ) : string Renders the markup for the button actions toolbar
renderWidget ( )
run ( )

Protected Methods

Method Description
hasModel ( ) : boolean
initDropdown ( ) Initialize tree dropdown menu settings and options
initTreeView ( )
renderDropdown ( string $content ) : string Generates the dropdown tree menu

Method Details

getInput() public method

Generates the hidden input for storage
public getInput ( ) : string
return string

hasModel() protected method

protected hasModel ( ) : boolean
return boolean whether this widget is associated with a data model.

initDropdown() protected method

Initialize tree dropdown menu settings and options
protected initDropdown ( )

initTreeView() protected method

protected initTreeView ( )

registerInputAssets() public method

Registers assets for TreeViewInput
public registerInputAssets ( )

renderDropdown() protected method

Generates the dropdown tree menu
protected renderDropdown ( string $content ) : string
$content string the content to be embedded in the dropdown menu
return string

renderToolbar() public method

Renders the markup for the button actions toolbar
public renderToolbar ( ) : string
return string

renderWidget() public method

public renderWidget ( )

run() public method

public run ( )

Property Details

$asDropdown public property

whether to show the input as a dropdown select. If set to false, it will display directly the tree view selector widget. Defaults to true. The BootstrapPluginAsset will automatically be loaded if this is set to true. Defaults to true.
public $asDropdown

$attribute public property

the model attribute that this widget is associated with.
public $attribute

$autoCloseOnSelect public property

whether to autoclose the dropdown on input selection when asDropdown is true. Defaults to true.
public $autoCloseOnSelect

$dropdownConfig public property

the configuration of the tree view dropdown. The following configuration options are available: - input: array the HTML attributes for the dropdown input container which displays the selected tree items. The following special options are available: - placeholder: string, defaults to Select... - dropdown: array, the HTML attributes for the dropdown tree view menu. - options: array, the HTML attributes for the wrapper container - caret: string, the markup for rendering the dropdown indicator for up and down. Defaults to TreeViewInput::CARET.
public $dropdownConfig

$model public property

the data model that this widget is associated with.
public $model

$name public property

the input name. This must be set if [[model]] and [[attribute]] are not set.
public $name

$options public property

the HTML attributes for the input that will store the selected nodes for the widget
public $options

$showToolbar public property

whether to show the toolbar in the footer. Defaults to false.
public $showToolbar

$value public property

the input value.
public $value