Blesta Source Documentation

InputFields implements FieldsInterface

Input Fields

Provides the structure for inputs to set which fields to appear when interacting with the input via Blesta in various places.

Table of Contents

Interfaces

FieldsInterface Fields Interface

Properties

$fields
$html

Methods

fieldButton() Creates a button with default type=button, can be overriden by attirbutes
fieldCheckbox() Creates a checkbox
fieldFile() Creates a file input field
fieldHidden() Creates a hidden input field
fieldImage() Creates an image input field
fieldMultiSelect() Creates a select list with multiple selectable options
fieldNumber() Creates a number input field
fieldPassword() Creates a password input field
fieldRadio() Creates a radio box
fieldReset() Creates a reset input field
fieldSelect() Creates a select list
fieldSubmit() Creates a button of type submit
fieldText() Creates a text input field
fieldTextarea() Creates a textarea field
getFields() Returns an array of fields set for this group of fields
getHtml() Returns an HTML content set for this group of fields
label() Creates a label with the given name and marks it for the given field
setField() Sets the field into the collection of FieldInterface objects
setHtml() Sets HTML content to be rendered into the view when outputting the fields.
tooltip() Creates a tooltip with the given message
Properties

$fields

private array<string|int, mixed> $fields = []

An array of FieldInterface objects, each representing a single input field and (optionally) its label

$html

private string $html = null

A string of HTML markup to include when outputting the fields. This can include things such as javascript.

Methods

fieldButton()

Creates a button with default type=button, can be overriden by attirbutes

public fieldButton(string $name[, string $value = null ][, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in the HTML value field

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldCheckbox()

Creates a checkbox

public fieldCheckbox(string $name[, string $value = null ][, bool $checked = false ][, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in the HTML value field

$checked : bool = false

True to set this field as checked

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldFile()

Creates a file input field

public fieldFile(string $name[, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldHidden()

Creates a hidden input field

public fieldHidden(string $name[, string $value = null ][, array<string|int, mixed> $attributes = [] ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in the HTML value field

$attributes : array<string|int, mixed> = []

Attributes for this input field

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to an InputField label

fieldImage()

Creates an image input field

public fieldImage(string $name[, string $value = null ][, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in the HTML value field

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldMultiSelect()

Creates a select list with multiple selectable options

public fieldMultiSelect(string $name[, array<string|int, mixed> $options = [] ][, string $selected_values = [] ][, array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $option_attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$options : array<string|int, mixed> = []

The options to place in this select list

$selected_values : string = []

The options to set as selected

$attributes : array<string|int, mixed> = []

Attributes for this input field

$option_attributes : array<string|int, mixed> = []

Attributes for each option to set. If single dimension will set the attributes for every option, if multi-dimensional will set option for each element key that matches in $options

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldNumber()

Creates a number input field

public fieldNumber(string $name[, string $value = null ][, int $min = null ][, int $max = null ][, int $step = null ][, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in the HTML value field

$min : int = null

Specifies the minimum value allowed

$max : int = null

Specifies the maximum value allowed

$step : int = null

Specifies the legal number intervals

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldPassword()

Creates a password input field

public fieldPassword(string $name[, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldRadio()

Creates a radio box

public fieldRadio(string $name[, string $value = null ][, bool $checked = false ][, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in the HTML value field

$checked : bool = false

True to set this field as checked

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldReset()

Creates a reset input field

public fieldReset(string $name[, string $value = null ][, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in the HTML value field

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldSelect()

Creates a select list

public fieldSelect(string $name[, array<string|int, mixed> $options = [] ][, mixed $selected_value = null ][, array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $option_attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$options : array<string|int, mixed> = []

The options to place in this select list

$selected_value : mixed = null

The option(s) to set as selected

$attributes : array<string|int, mixed> = []

Attributes for this input field

$option_attributes : array<string|int, mixed> = []

Attributes for each option to set. If single dimension will set the attributes for every option, if multi-dimensional will set option for each element key that matches in $options

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldSubmit()

Creates a button of type submit

public fieldSubmit(string $name[, string $value = null ][, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in the HTML value field

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldText()

Creates a text input field

public fieldText(string $name[, string $value = null ][, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in the HTML value field

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

fieldTextarea()

Creates a textarea field

public fieldTextarea(string $name[, string $value = null ][, array<string|int, mixed> $attributes = [] ][, FieldInterface $label = null ]) : InputField
Parameters
$name : string

The name to set in the HTML name field

$value : string = null

The value to set in this textarea

$attributes : array<string|int, mixed> = []

Attributes for this input field

$label : FieldInterface = null

A FieldInterface object representing the label to attach to this field (see InputFields::label)

Tags
see
InputFields::label()
see
InputField::attach()
Return values
InputField

An InputField object that can be attached to a FieldInterface label

getFields()

Returns an array of fields set for this group of fields

public getFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array of FieldInterface objects set for this group of fields

getHtml()

Returns an HTML content set for this group of fields

public getHtml() : string
Return values
string

The HTML content set for this group of fields

label()

Creates a label with the given name and marks it for the given field

public label(string $name[, string $for = null ][, array<string|int, mixed> $attributes = null ][, bool $preserve_tags = false ]) : InputField
Parameters
$name : string

The name of this label

$for : string = null

The ID of the form element this label is part of

$attributes : array<string|int, mixed> = null

Attributes for this label

$preserve_tags : bool = false

True to preserve tags in the label name

Return values
InputField

An InputField object to be passed into one of the various field methods to assign this label to that field

setField()

Sets the field into the collection of FieldInterface objects

public setField(FieldInterface $field) : mixed
Parameters
$field : FieldInterface

A FieldInterface object to be passed set into the list of FieldInterface objects

setHtml()

Sets HTML content to be rendered into the view when outputting the fields.

public setHtml(string $html) : mixed

This is intended to allow for the inclusion of javascript to dynamically handle the rendering of the fields, but is not limited to such.

Parameters
$html : string

The HTML content to render into the view when outputting the fields

tooltip()

Creates a tooltip with the given message

public tooltip(string $message) : InputField
Parameters
$message : string

The tooltip message

Return values
InputField

An InputField object that can be attached to an InputField label

Tags
subpackage

core.Util.Input.Fields

copyright

Copyright (c) 2020, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta

see
InputField

        
On this page

Search results