PHP Класс kartik\builder\Form

Usage example: ~~~ use kartik\form\ActiveForm; use kartik\builder\Form; $form = ActiveForm::begin($options); // $options will be your form config array params. echo Form::widget([ 'model' => $model, // your model 'form' => $form, 'columns' => 2, 'attributes' => [ 'username' => ['type' => Form::INPUT_TEXT, 'options'=> ['placeholder'=>'Enter username...']], 'password' => ['type' => Form::INPUT_PASSWORD], 'rememberMe' => ['type' => Form::INPUT_CHECKBOX, 'enclosedByLabel' => true], ] ]); ActiveForm::end(); ~~~
С версии: 1.0
Автор: Kartik Visweswaran ([email protected])
Наследование: extends BaseForm
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$autoGenerateColumns calculate the number of columns automatically based on count of attributes configured in the Form widget. Columns will be created maximum upto the [[GRID_WIDTH]].
$columnOptions the HTML attributes for the grid columns. Applicable only if [[columns]] is greater than 1.
$columnSize the bootstrap device size for rendering each grid column. Defaults to [[SIZE_SMALL]].
$columns the number of columns in which to split the fields horizontally. If not set, defaults to 1 column.
$contentAfter content to display after the generated form fields. This is not HTML encoded.
$contentBefore content to display before the generated form fields. This is not HTML encoded.
$model the data model used for the form.
$options the HTML attributes for the field/attributes container. The following options are additionally recognized: - tag: _string_, the HTML tag for the container. Defaults to fieldset.
$rowOptions the HTML attributes for the rows. Applicable only if [[columns]] is greater than 1.

Открытые методы

Метод Описание
init ( )
run ( )

Защищенные методы

Метод Описание
beginTag ( string $tag, array $options = [], boolean $skip = false ) : string Begins a tag markup based on orientation.
endTag ( string $tag, boolean $skip = false ) : string Ends a tag markup based on orientation.
getSubAttributesContent ( array $settings, string $index ) : string Gets sub attribute markup content.
initOptions ( ) Initializes the widget options
parseInput ( string $attribute, string $settings, integer $index ) : string Parses the input markup based on type.
raise ( string $event = '', string $attribute = '', integer | string $index = '', array $data = [] ) Triggers an ActiveFormEvent.
registerAssets ( ) Registers widget assets
renderFieldSet ( ) : string Renders the field set.
renderSubAttributes ( array $settings, string $index ) : string Render sub attributes.

Описание методов

beginTag() защищенный Метод

Begins a tag markup based on orientation.
protected beginTag ( string $tag, array $options = [], boolean $skip = false ) : string
$tag string the HTML tag
$options array the HTML attributes for the tag
$skip boolean whether to skip the tag generation
Результат string

endTag() защищенный Метод

Ends a tag markup based on orientation.
protected endTag ( string $tag, boolean $skip = false ) : string
$tag string the HTML tag
$skip boolean whether to skip the tag generation
Результат string

getSubAttributesContent() защищенный Метод

Gets sub attribute markup content.
protected getSubAttributesContent ( array $settings, string $index ) : string
$settings array the attribute settings
$index string the zero-based index of the attribute
Результат string

init() публичный Метод

public init ( )

initOptions() защищенный Метод

Initializes the widget options
protected initOptions ( )

parseInput() защищенный Метод

Parses the input markup based on type.
protected parseInput ( string $attribute, string $settings, integer $index ) : string
$attribute string the model attribute.
$settings string the column settings.
$index integer the row index.
Результат string the generated input.

raise() защищенный Метод

Triggers an ActiveFormEvent.
protected raise ( string $event = '', string $attribute = '', integer | string $index = '', array $data = [] )
$event string the event name.
$attribute string the attribute name.
$index integer | string the row index.
$data array the event data to pass to the event.

registerAssets() защищенный Метод

Registers widget assets
protected registerAssets ( )

renderFieldSet() защищенный Метод

Renders the field set.
protected renderFieldSet ( ) : string
Результат string

renderSubAttributes() защищенный Метод

Render sub attributes.
protected renderSubAttributes ( array $settings, string $index ) : string
$settings array the attribute settings
$index string the zero-based index of the attribute
Результат string

run() публичный Метод

public run ( )

Описание свойств

$autoGenerateColumns публичное свойство

calculate the number of columns automatically based on count of attributes configured in the Form widget. Columns will be created maximum upto the [[GRID_WIDTH]].
public $autoGenerateColumns

$columnOptions публичное свойство

the HTML attributes for the grid columns. Applicable only if [[columns]] is greater than 1.
public $columnOptions

$columnSize публичное свойство

the bootstrap device size for rendering each grid column. Defaults to [[SIZE_SMALL]].
public $columnSize

$columns публичное свойство

the number of columns in which to split the fields horizontally. If not set, defaults to 1 column.
public $columns

$contentAfter публичное свойство

content to display after the generated form fields. This is not HTML encoded.
public $contentAfter

$contentBefore публичное свойство

content to display before the generated form fields. This is not HTML encoded.
public $contentBefore

$model публичное свойство

the data model used for the form.
public $model

$options публичное свойство

the HTML attributes for the field/attributes container. The following options are additionally recognized: - tag: _string_, the HTML tag for the container. Defaults to fieldset.
public $options

$rowOptions публичное свойство

the HTML attributes for the rows. Applicable only if [[columns]] is greater than 1.
public $rowOptions