PHP Класс Bootstrap\View\Helper\BootstrapFormHelper

Наследование: extends Cake\View\Helper\FormHelper, use trait BootstrapTrait
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$helpers
$horizontal
$inline

Защищенные свойства (Protected)

Свойство Тип Описание
$_defaultConfig array Default config for the helper.
$_defaultWidgets array Default widgets

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

Метод Описание
append ( $input, $append )
button ( $title, array $options = [] ) Create & return a Twitter Like button.
buttonGroup ( $buttons, array $options = [] ) Create & return a Twitter Like button group.
buttonToolbar ( array $buttonGroups, array $options = [] ) Create & return a Twitter Like button toolbar.
create ( $model = null, array $options = [] ) : The Create a Twitter Bootstrap like form.
date ( string $fieldName, array $options = [] ) : string Generate date inputs.
dateTime ( string $fieldName, array $options = [] ) : string Returns a set of SELECT elements for a full datetime setup: day, month and year, and then time.
dropdownButton ( $title, array $menu = [], array $options = [] ) Create & return a twitter bootstrap dropdown button. This function is a shortcut for:
file ( string $fieldName, array $options = [] ) : string Creates file input widget.
formatTemplate ( $name, $data )
input ( $fieldName, array $options = [] ) Create & return an input block (Twitter Boostrap Like).
prepend ( $input, $prepend )
searchForm ( $model = null, $options = [], $inpOpts = [], $btnOpts = [] ) Create a basic bootstrap search form.
submit ( $caption = null, array $options = [] ) Create & return a Twitter Like submit input.
time ( string $fieldName, array $options = [] ) : string Generate time inputs.
widget ( $name, array $data = [] )
wrap ( $input, $prepend, $append )

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

Метод Описание
_createButtonOptions ( array $options = [] ) Create & return a Cakephp options array from the $options specified.
_getColClass ( $what, $offset = false ) Return the col size class for the specified column (label, input or error).
_getDatetimeTemplate ( $fields, $options )
_getDefaultTemplateVars ( &$options )
_inputContainerTemplate ( $options )
_matchButton ( $html ) : true Try to match the specified HTML code with a button or a input with submit type.
_wrap ( $input, $prepend, $append )
_wrapInputGroup ( $addonOrButtons )
_wrapTemplates ( $templates, $callback, $params ) : The Replace the templates with the ones specified by newTemplates, call the specified function with the specified parameters, and then restore the old templates.

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

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

Create & return a Cakephp options array from the $options specified.
protected _createButtonOptions ( array $options = [] )
$options array

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

Return the col size class for the specified column (label, input or error).
protected _getColClass ( $what, $offset = false )

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

protected _getDatetimeTemplate ( $fields, $options )

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

protected _getDefaultTemplateVars ( &$options )

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

protected _inputContainerTemplate ( $options )

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

Try to match the specified HTML code with a button or a input with submit type.
protected _matchButton ( $html ) : true
$html The HTML code to check
Результат true if the HTML code contains a button

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

protected _wrap ( $input, $prepend, $append )

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

protected _wrapInputGroup ( $addonOrButtons )

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

Replace the templates with the ones specified by newTemplates, call the specified function with the specified parameters, and then restore the old templates.
protected _wrapTemplates ( $templates, $callback, $params ) : The
Результат The return value of $callback

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

public append ( $input, $append )

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

### New options: - bootstrap-type: Twitter bootstrap button type (primary, danger, info, etc.) - bootstrap-size: Twitter bootstrap button size (mini, small, large)
public button ( $title, array $options = [] )
$options array

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

Create & return a Twitter Like button group.
public buttonGroup ( $buttons, array $options = [] )
$buttons The buttons in the group
$options array Options for div method Extra options: - vertical true/false

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

Create & return a Twitter Like button toolbar.
public buttonToolbar ( array $buttonGroups, array $options = [] )
$buttonGroups array
$options array Options for div method

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

New options available: - horizontal: boolean, specify if the form is horizontal - inline: boolean, specify if the form is inline - search: boolean, specify if the form is a search form Unusable options: - inputDefaults
public create ( $model = null, array $options = [] ) : The
$model The model corresponding to the form
$options array Options to customize the form
Результат The HTML tags corresponding to the openning of the form

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

### Options: See dateTime() for date options.
См. также: Cake\View\Helper\FormHelper::dateTime() for templating options.
public date ( string $fieldName, array $options = [] ) : string
$fieldName string Prefix name for the SELECT element
$options array Array of Options
Результат string Generated set of select boxes for time formats chosen.

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

### Date Options: - empty - If true, the empty select option is shown. If a string, that string is displayed as the empty element. - value | default The default value to be used by the input. A value in $this->data matching the field name will override this value. If no default is provided time() will be used. - monthNames If false, 2 digit numbers will be used instead of text. If an array, the given array will be used. - minYear The lowest year to use in the year select - maxYear The maximum year to use in the year select - orderYear - Order of year values in select options. Possible values 'asc', 'desc'. Default 'desc'. ### Time options: - empty - If true, the empty select option is shown. If a string, - value | default The default value to be used by the input. A value in $this->data matching the field name will override this value. If no default is provided time() will be used. - timeFormat The time format to use, either 12 or 24. - interval The interval for the minutes select. Defaults to 1 - round - Set to up or down if you want to force rounding in either direction. Defaults to null. - second Set to true to enable seconds drop down. To control the order of inputs, and any elements/content between the inputs you can override the dateWidget template. By default the dateWidget template is: {{month}}{{day}}{{year}}{{hour}}{{minute}}{{second}}{{meridian}}`
public dateTime ( string $fieldName, array $options = [] ) : string
$fieldName string Prefix name for the SELECT element
$options array Array of Options
Результат string Generated set of select boxes for the date and time formats chosen.

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

$this->Form->$buttonGroup([ $this->Form->button($title, $options), $this->Html->dropdown($menu, []) ]);
public dropdownButton ( $title, array $menu = [], array $options = [] )
$title The text in the button
$menu array HTML tags corresponding to menu options (which will be wrapped into
  • tag). To add separator, pass 'divider'.
  • $options array Options for button

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

    Creates file input widget.
    public file ( string $fieldName, array $options = [] ) : string
    $fieldName string Name of a field, in the form "modelname.fieldname"
    $options array Array of HTML attributes.
    Результат string A generated file input.

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

    public formatTemplate ( $name, $data )

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

    New options: - prepend: -> string: Add before the input -> array: Add elements in array before inputs - append: Same as prepend except it add elements after input
    public input ( $fieldName, array $options = [] )
    $options array

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

    public prepend ( $input, $prepend )

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

    Create a basic bootstrap search form.
    public searchForm ( $model = null, $options = [], $inpOpts = [], $btnOpts = [] )
    $model The model of the form
    $options The options that will be pass to the BootstrapForm::create method
    $inpOpts The options that will be pass to the BootstrapForm::input method
    $btnOpts The options that will be pass to the BootstrapForm::button method Extra options: - id ID of the input (and fieldname) - label The input label (default false) - placeholder The input placeholder (default "Search... ") - button The search button text (default: "Search") - _input Options for the input (overrided by $inpOpts) - _button Options for the button (overrided by $btnOpts)

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

    New options: - bootstrap-type: Twitter bootstrap button type (primary, danger, info, etc.) - bootstrap-size: Twitter bootstrap button size (mini, small, large) Unusable options: div
    public submit ( $caption = null, array $options = [] )
    $options array

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

    ### Options: See dateTime() for time options.
    См. также: Cake\View\Helper\FormHelper::dateTime() for templating options.
    public time ( string $fieldName, array $options = [] ) : string
    $fieldName string Prefix name for the SELECT element
    $options array Array of Options
    Результат string Generated set of select boxes for time formats chosen.

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

    public widget ( $name, array $data = [] )
    $data array

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

    public wrap ( $input, $prepend, $append )

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

    $_defaultConfig защищенное свойство

    Default config for the helper.
    protected array $_defaultConfig
    Результат array

    $_defaultWidgets защищенное свойство

    Default widgets
    protected array $_defaultWidgets
    Результат array

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

    public $helpers

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

    public $horizontal

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

    public $inline