PHP Class BootstrapUI\View\Helper\FormHelper

Inheritance: extends Cake\View\Helper\FormHelper, use trait OptionsAwareTrait
Afficher le fichier Open project: friendsofcake/bootstrap-ui Class Usage Examples

Protected Properties

Свойство Type Description
$_align string Set on Form::create() to tell if the type of alignment used (i.e. horizontal).
$_templateSet array Templates set per alignment type
$_templates array Default Bootstrap string templates.
$_widgets array Default Bootstrap widgets.

Méthodes publiques

Méthode Description
__construct ( Cake\View\View $View, array $config = [] ) Construct the widgets and binds the default context providers.
create ( mixed $model = null, array $options = [] ) : string Returns an HTML FORM element.
end ( array $secureAttributes = [] ) : string Closes an HTML form, cleans up values set by FormHelper::create(), and writes hidden input fields where appropriate.
input ( string $fieldName, array $options = [] ) : string Generates a form input element complete with label and wrapper div.
staticControl ( string $fieldName, array $options = [] ) : string Used to place plain text next to label within a form.
submit ( string $caption = null, array $options = [] ) : string Creates a submit button element.

Méthodes protégées

Méthode Description
_detectFormAlignment ( array $options ) : string Detects the form alignment when possible.
_formAlignment ( array $options ) : array Form alignment detector/switcher.
_getInput ( string $fieldName, array $options ) : string Generates an input element.
_gridClass ( string $position, boolean $offset = false ) : string Returns a Bootstrap grid class (i.e. col-md-2).
_groupTemplate ( array $options ) : string Generates an group template element
_inputContainerTemplate ( array $options ) : string Generates an input container template
_parseOptions ( string $fieldName, array $options ) : array Generates input options array

Method Details

__construct() public méthode

Construct the widgets and binds the default context providers.
public __construct ( Cake\View\View $View, array $config = [] )
$View Cake\View\View The View this helper is being attached to.
$config array Configuration settings for the helper.

_detectFormAlignment() protected méthode

Detects the form alignment when possible.
protected _detectFormAlignment ( array $options ) : string
$options array Options.
Résultat string Form alignment type. One of `default`, `horizontal` or `inline`.

_formAlignment() protected méthode

Form alignment detector/switcher.
protected _formAlignment ( array $options ) : array
$options array Options.
Résultat array Modified options.

_getInput() protected méthode

Overrides parent method to unset 'help' key.
protected _getInput ( string $fieldName, array $options ) : string
$fieldName string The field's name.
$options array The options for the input element.
Résultat string The generated input element.

_gridClass() protected méthode

Returns a Bootstrap grid class (i.e. col-md-2).
protected _gridClass ( string $position, boolean $offset = false ) : string
$position string One of `left`, `middle` or `right`.
$offset boolean If true, will append `offset-` to the class.
Résultat string Classes.

_groupTemplate() protected méthode

Generates an group template element
protected _groupTemplate ( array $options ) : string
$options array The options for group template
Résultat string The generated group template

_inputContainerTemplate() protected méthode

Generates an input container template
protected _inputContainerTemplate ( array $options ) : string
$options array The options for input container template.
Résultat string The generated input container template.

_parseOptions() protected méthode

Generates input options array
protected _parseOptions ( string $fieldName, array $options ) : array
$fieldName string The name of the field to parse options for.
$options array Options list.
Résultat array Options

create() public méthode

Returns an HTML FORM element.
public create ( mixed $model = null, array $options = [] ) : string
$model mixed The context for which the form is being defined. Can be an ORM entity, ORM resultset, or an array of meta data. You can use false or null to make a model-less form.
$options array An array of html attributes and options.
Résultat string An formatted opening FORM tag.

end() public méthode

Overrides parent method to reset the form alignment and grid size.
public end ( array $secureAttributes = [] ) : string
$secureAttributes array Secure attributes which will be passed as HTML attributes into the hidden input elements generated for the Security Component.
Résultat string A closing FORM tag.

input() public méthode

Adds extra option besides the ones supported by parent class method: - append - Append addon to input. - prepend - Prepend addon to input. - inline - Boolean for generating inline checkbox/radio. - help - Help text of include in the input container.
public input ( string $fieldName, array $options = [] ) : string
$fieldName string This should be "Modelname.fieldname".
$options array Each type of input takes different options.
Résultat string Completed form widget.

staticControl() public méthode

### Options: - hiddenField - boolean to indicate if you want value for field included in a hidden input. Defaults to true.
public staticControl ( string $fieldName, array $options = [] ) : string
$fieldName string Name of a field, like this "modelname.fieldname"
$options array Array of HTML attributes.
Résultat string An HTML text input element.

submit() public méthode

Overrides parent method to add CSS class btn, to the element.
public submit ( string $caption = null, array $options = [] ) : string
$caption string The label appearing on the button OR if string contains :// or the extension .jpg, .jpe, .jpeg, .gif, .png use an image if the extension exists, AND the first character is /, image is relative to webroot, OR if the first character is not /, image is relative to webroot/img.
$options array Array of options. See above.
Résultat string A HTML submit button

Property Details

$_align protected_oe property

Set on Form::create() to tell if the type of alignment used (i.e. horizontal).
protected string $_align
Résultat string

$_templateSet protected_oe property

Templates set per alignment type
protected array $_templateSet
Résultat array

$_templates protected_oe property

Default Bootstrap string templates.
protected array $_templates
Résultat array

$_widgets protected_oe property

Default Bootstrap widgets.
protected array $_widgets
Résultat array