PHP Class 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(); ~~~
Since: 1.0
Author: Kartik Visweswaran ([email protected])
Inheritance: extends BaseForm
Afficher le fichier Open project: kartik-v/yii2-builder Class Usage Examples

Méthodes publiques

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
init ( )
run ( )

Méthodes protégées

Méthode Description
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.

Method Details

beginTag() protected méthode

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
Résultat string

endTag() protected méthode

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
Résultat string

getSubAttributesContent() protected méthode

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
Résultat string

init() public méthode

public init ( )

initOptions() protected méthode

Initializes the widget options
protected initOptions ( )

parseInput() protected méthode

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.
Résultat string the generated input.

raise() protected méthode

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() protected méthode

Registers widget assets
protected registerAssets ( )

renderFieldSet() protected méthode

Renders the field set.
protected renderFieldSet ( ) : string
Résultat string

renderSubAttributes() protected méthode

Render sub attributes.
protected renderSubAttributes ( array $settings, string $index ) : string
$settings array the attribute settings
$index string the zero-based index of the attribute
Résultat string

run() public méthode

public run ( )

Property Details

$autoGenerateColumns public_oe property

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 public_oe property

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

$columnSize public_oe property

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

$columns public_oe property

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

$contentAfter public_oe property

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

$contentBefore public_oe property

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

$model public_oe property

the data model used for the form.
public $model

$options public_oe property

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 public_oe property

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