Documentation

Form
in package

Helper functions for outputting form elements.

Wraps form fields (e.g. from Fb) with additional HTML.

Most wrapping will done using the __callStatic method which actually just calls Form::fieldAuto. That method uses reflection to look for a custom docblock tag, @wrap-in-fieldset. If that docblock tag is found, the field is wrapped in Form::fieldFieldset If that docblock tag is not found (the most common case), the field is wrapped in Form::fieldPlain

If the field being wrapped isn't in the Fb helper, the methods fieldAuto, fieldPlain, and fieldFieldset can be invoked directly.

The outermost wrapper DIV around the field has a class of "field-element". Additional classes are also added:

  • The method and class name, in the format 'field-element--id-'
  • If an "id" attribute is set, in the format 'field-element--id-'
  • If the field is required, 'field-element--required'
  • If the field is disabled, 'field-element--disabled'
  • If the field has an error, 'field-element--error'
  • One or more custom classes can be specified using the attribute "-wrapper-class". Each (array or space separated) class is prefixed with 'field-element--'
Tags
example

Form::setData($data); Form::setErrors($errors);

Form::nextFieldDetails('First name', true); echo Form::text('first_name');

Form::nextFieldDetails('Email', true, 'Please enter your email address'); echo Form::email('email', [], ['-wrapper-class' => 'small']);

Form::nextFieldDetails('Phone', false, 'Enter a phone number using the unique UI'); echo Form::fieldPlain('SproutModules\Someone\CustomModule\Helpers\FbHack::phone', 'phone', [], []);

Table of Contents

Properties

$errors  : mixed
$id_prefix  : mixed
$name_format  : mixed
$next_helptext  : mixed
$next_label  : mixed
$next_required  : mixed

Methods

__call()  : string
Auto-wrapper around Fb methods
__callStatic()  : string
Auto-wrapper around Fb methods
autocomplete()  : string
autoCompleteAddress()  : string
autocompleteList()  : string
autofillList()  : string
Returns HTML for an auto-complete list of records
checkbox()  : string
checkboxBoolList()  : string
checkboxList()  : string
Returns HTML for a list of checkboxes, applying name conversions along the way
checkboxSet()  : string
chunkedUpload()  : string
colorpicker()  : string
conditionsList()  : string
datepicker()  : string
daterangepicker()  : string
datetimepicker()  : string
datetimerangepicker()  : string
dropdown()  : string
dropdownItems()  : string
dropdownTree()  : string
dropdownTreeItem()  : string
dualRange()  : string
email()  : string
fieldAuto()  : string
Return HTML for a field, with the wrapping HTML detected automatically.
fieldFieldset()  : string
Return HTML for a field wrapped in a FIELDSET
fieldPlain()  : string
Return HTML for a 'plain' field, i.e. one which doesn't require a FIELDSET wrapped around it.
fileSelector()  : string
geocodeAddress()  : string
getData()  : mixed
Gets the form per-field value for a single field
getFieldErrors()  : array<string|int, mixed>
Return the errors for a given field
googleMap()  : string
html()  : string
Return HTML which has been wrapped in the form field DIVs
input()  : string
lnk()  : string
loadFromSession()  : array<string|int, mixed>|null
Load data and errors from the session, with optional record id validation
money()  : string
Returns HTML for a money field, using {@see Fb::money} to generate the field itself
multiline()  : string
multipleFileSelect()  : string
multiradio()  : string
Returns HTML for a bunch of radiobuttons, using {@see Fb::multiradio} to generate the fields
nextFieldDetails()  : void
Set the details for the next field which will be outputted.
number()  : string
Returns HTML for a number field, using {@see Fb::number} to generate the field itself
out()  : string
Return content which has been HTML-encoded and wrapped in the form field DIVs
output()  : string
pageDropdown()  : string
password()  : string
Returns HTML for a password field, using {@see Fb::password} to generate the field itself
phone()  : string
randomCode()  : string
range()  : string
resetField()  : mixed
Reset the state machine for field values
richtext()  : string
setData()  : mixed
Set form per-field values for the fields
setErrors()  : mixed
Set per-field error messages to display
setFieldIdPrefix()  : mixed
Sets the prefix for generated IDs
setFieldNameFormat()  : mixed
Set a format string which will alter the field name prior to being passed to the underlying render method
setFieldValue()  : void
Sets the value for a single field
simpledaterangepicker()  : string
tag()  : string
text()  : string
Returns HTML for a text field, using {@see Fb::text} to generate the field itself
timepicker()  : string
totalselector()  : string
upload()  : string
convertFieldName()  : string
Format a field name as per the specification defined by {@see Form::setFieldNameFormat}
fieldMethodClass()  : string
Convert a full method name (e.g. Sprout\Helpers\Fb::text) into a friendly class name
genId()  : string
Generate a unique id which should be stable across calls to this URL as long as the number and order of fields on the page remains the same
passString()  : string
Returns the first argument

Properties

$errors

public static mixed $errors

$id_prefix

public static mixed $id_prefix = ''

$name_format

public static mixed $name_format = "%s"

$next_helptext

public static mixed $next_helptext = null

$next_label

public static mixed $next_label = null

$next_required

public static mixed $next_required = null

Methods

__call()

Auto-wrapper around Fb methods

public __call(string $func, array<string|int, mixed> $args) : string

Will wrap the Fb method with the same name as the called method, e.g. Form::datepicker wraps Fb::datepicker Wrapping is done using Form::fieldAuto

Parameters
$func : string

Method name

$args : array<string|int, mixed>

Method arguments

Return values
string —

HTML

__callStatic()

Auto-wrapper around Fb methods

public static __callStatic(string $func, array<string|int, mixed> $args) : string

Will wrap the Fb method with the same name as the called method, e.g. Form::datepicker wraps Fb::datepicker Wrapping is done using Form::fieldAuto

Parameters
$func : string

Method name

$args : array<string|int, mixed>

Method arguments

Return values
string —

HTML

autocomplete()

public static autocomplete(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

autoCompleteAddress()

public static autoCompleteAddress(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

autocompleteList()

public static autocompleteList(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

autofillList()

Returns HTML for an auto-complete list of records

public static autofillList(string $name[, array<string|int, mixed> $attrs = [] ][, array<string|int, mixed> $options = [] ]) : string

The form data for this field should be an array of arrays with at least the following keys: [ 'id' => record ID, 'value' => title text visible in the list item, 'orderkey' => ordinal value for record ordering ]

Parameters
$name : string

Field name

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

Unused

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

Options; these are passed to the JS lookup_url string AJAX lookup URL, Fb::autocomplete; Required min_term_length int Min term length for autocomplete; default = 3 reorder bool Default = false

Return values
string —

HTML

checkbox()

public static checkbox(mixed $name, mixed $label, mixed $value, mixed $selected[, array<string|int, mixed> $attrs = = '[]' ]) : string
Parameters
$name : mixed
$label : mixed
$value : mixed
$selected : mixed
$attrs : array<string|int, mixed> = = '[]'
Return values
string

checkboxBoolList()

public static checkboxBoolList(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $settings = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$settings : array<string|int, mixed> = = '[]'
Return values
string

checkboxList()

Returns HTML for a list of checkboxes, applying name conversions along the way

public static checkboxList(array<string|int, mixed> $checkboxes[, array<string|int, mixed> $attrs = [] ]) : string

Uses Fb::checkboxBoolList to generate the underlying checkbox list

Parameters
$checkboxes : array<string|int, mixed>

An array of name => label mappings

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

Extra attributes applied to each checkbox field

Return values
string —

HTML

checkboxSet()

public static checkboxSet(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $settings = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$settings : array<string|int, mixed> = = '[]'
Return values
string

chunkedUpload()

public static chunkedUpload(string $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : string
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

colorpicker()

public static colorpicker(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $params = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$params : array<string|int, mixed> = = '[]'
Return values
string

conditionsList()

public static conditionsList(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $params = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$params : array<string|int, mixed> = = '[]'
Return values
string

datepicker()

public static datepicker(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

daterangepicker()

public static daterangepicker(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

datetimepicker()

public static datetimepicker(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

datetimerangepicker()

public static datetimerangepicker(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

dropdown()

public static dropdown(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

dropdownItems()

public static dropdownItems(array<string|int, mixed> $options[, mixed $selected = = 'null' ]) : string
Parameters
$options : array<string|int, mixed>
$selected : mixed = = 'null'
Return values
string

dropdownTree()

public static dropdownTree(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

dropdownTreeItem()

public static dropdownTreeItem(mixed $node, mixed $depth, mixed $selected, mixed $exclude) : string
Parameters
$node : mixed
$depth : mixed
$selected : mixed
$exclude : mixed
Return values
string

dualRange()

public static dualRange(mixed $unused[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$unused : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

email()

public static email(string $name[, array<string|int, mixed> $attrs = = '[]' ]) : string
Parameters
$name : string
$attrs : array<string|int, mixed> = = '[]'
Return values
string

fieldAuto()

Return HTML for a field, with the wrapping HTML detected automatically.

public static fieldAuto(callable $method, string $name[, array<string|int, mixed> $attrs = [] ][, array<string|int, mixed> $options = [] ]) : string

To enable fieldset wrapping, add the docblock tag @wrap-in-fieldset to the field generation method

Parameters
$method : callable

The actual field rendering method

$name : string

The field name - this is passed to the rendering method

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

The field attrs - this is passed to the rendering method

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

The field options - this is passed to the rendering method

Return values
string —

HTML

fieldFieldset()

Return HTML for a field wrapped in a FIELDSET

public static fieldFieldset(callable $method, string $name[, array<string|int, mixed> $attrs = [] ][, array<string|int, mixed> $options = [] ]) : string

The main wrapping DIV will contain additional classes if the field is required, disabled or has an error. A class is also output for hte field method name (if the name contains "Sprout\Helpers\Fb::" this is removed) If the field has an explicit ID set, that will be added as a class on the wrapper too.

The special attribute "-wrapper-class" can be used to add classes to the wrapper DIV. Multiple classes can be specified, space separated. These classes will be prefixed with "field-element--"

Parameters
$method : callable

The actual field rendering method

$name : string

The field name - this is passed to the rendering method

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

The field attrs - this is passed to the rendering method

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

The field options - this is passed to the rendering method

Return values
string —

HTML

fieldPlain()

Return HTML for a 'plain' field, i.e. one which doesn't require a FIELDSET wrapped around it.

public static fieldPlain(callable $method, string $name[, array<string|int, mixed> $attrs = [] ][, array<string|int, mixed> $options = [] ]) : string

The main wrapping DIV will contain additional classes if the field is required, disabled or has an error. A class is also output for the field method name (if the name contains "Sprout\Helpers\Fb::" this is removed) If the field has an explicit ID set, that will be added as a class on the wrapper too.

The special attribute "-wrapper-class" can be used to add classes to the wrapper DIV. Multiple classes can be specified, space separated. These classes will be prefixed with "field-element--"

Parameters
$method : callable

The actual field rendering method

$name : string

The field name - this is passed to the rendering method

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

The field attrs - this is passed to the rendering method

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

The field options - this is passed to the rendering method

Tags
example

echo Form::fieldPlain('Sprout\Helpers\Fb::text', 'first_name', [], []);

// Adds the class "field-element--id-first-name" to the wrapper echo Form::fieldPlain('Sprout\Helpers\Fb::text', 'first_name', ['id' => 'first-name'], []);

// Adds the class "field-element--small" to the wrapper echo Form::fieldPlain('Sprout\Helpers\Fb::text', 'first_name', ['-wrapper-class' => 'small'], []);

Return values
string —

HTML

fileSelector()

public static fileSelector(string $name[, array<string|int, mixed> $unused = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : string
$unused : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

geocodeAddress()

public static geocodeAddress(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

getData()

Gets the form per-field value for a single field

public static getData(string $field) : mixed

As form field datas are stored using the Fb class, this method just gets the data from there

Parameters
$field : string

The field name

getFieldErrors()

Return the errors for a given field

public static getFieldErrors(string $field_name) : array<string|int, mixed>

Supports nested error arrays; If $field_name is something like member[5][test] then the error will be read from self::$errors['member']['5']['test']

Parameters
$field_name : string

Field to return errors for

Return values
array<string|int, mixed> —

Error messages, as strings

googleMap()

public static googleMap(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $params = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$params : array<string|int, mixed> = = '[]'
Return values
string

html()

Return HTML which has been wrapped in the form field DIVs

public static html(string $html) : string
Parameters
$html : string

Content to wrap in the field

Return values
string —

HTML

input()

public static input(string $name[, array<string|int, mixed> $params = = '[]' ]) : string
Parameters
$name : string
$params : array<string|int, mixed> = = '[]'
Return values
string

lnk()

public static lnk(string $name[, array<string|int, mixed> $unused = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : string
$unused : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

loadFromSession()

Load data and errors from the session, with optional record id validation

public static loadFromSession(string $key[, int|null $verify_record_id = null ]) : array<string|int, mixed>|null

Expected session keys: record_id Checked against $verify_record_id, session data is thrown away in case of mismatch field_values Field data, loaded using Form::setData field_errors Field errors, loaded using Form::setErrors

Parameters
$key : string

Session key to get values from

$verify_record_id : int|null = null

For edit record verification

Tags
example

$data = Form::loadFromSession('register'); if (empty($data)) { $data = $this->add_defaults; Form::setData($data); }

Return values
array<string|int, mixed>|null —

Loaded session data if found

money()

Returns HTML for a money field, using {@see Fb::money} to generate the field itself

public static money(string $name[, array<string|int, mixed> $attrs = [] ][, array<string|int, mixed> $options = [] ]) : string
Parameters
$name : string

The name of the input field

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

Extra attributes for the input field

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

HTML

multiline()

public static multiline(string $name[, array<string|int, mixed> $unused = = '[]' ]) : string
Parameters
$name : string
$unused : array<string|int, mixed> = = '[]'
Return values
string

multipleFileSelect()

public static multipleFileSelect(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

multiradio()

Returns HTML for a bunch of radiobuttons, using {@see Fb::multiradio} to generate the fields

public static multiradio(string $name[, array<string|int, mixed> $attrs = [] ][, array<string|int, mixed> $options = [] ]) : string
Parameters
$name : string

The name of the input field

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

Extra attributes for the input field

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

HTML

nextFieldDetails()

Set the details for the next field which will be outputted.

public static nextFieldDetails(string $label, bool $required[, string $helptext = null ]) : void

After returning a field, these values will be cleared from the state machine

Both the label and helptext support a subset of HTML, Text::limitedSubsetHtml for more details

Parameters
$label : string

Human label for the field (e.g. 'Email address'). Some HTML allowed

$required : bool

True if this field is required, false if it's optional

$helptext : string = null

Optional HTML helptext

number()

Returns HTML for a number field, using {@see Fb::number} to generate the field itself

public static number(string $name[, array<string|int, mixed> $attrs = [] ]) : string
Parameters
$name : string

The name of the input field

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

Extra attributes for the input field

Return values
string —

HTML

out()

Return content which has been HTML-encoded and wrapped in the form field DIVs

public static out(string $plain) : string
Parameters
$plain : string

Plain text to encode and wrap in the field

Return values
string —

HTML

output()

public static output(string $name[, array<string|int, mixed> $attrs = = '[]' ]) : string
Parameters
$name : string
$attrs : array<string|int, mixed> = = '[]'
Return values
string

pageDropdown()

public static pageDropdown(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

password()

Returns HTML for a password field, using {@see Fb::password} to generate the field itself

public static password(string $name[, array<string|int, mixed> $attrs = [] ]) : string
Parameters
$name : string

The name of the input field

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

Extra attributes for the input field

Return values
string —

HTML

phone()

public static phone(string $name[, array<string|int, mixed> $attrs = = '[]' ]) : string
Parameters
$name : string
$attrs : array<string|int, mixed> = = '[]'
Return values
string

randomCode()

public static randomCode(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

range()

public static range(string $name[, array<string|int, mixed> $attrs = = '[]' ]) : string
Parameters
$name : string
$attrs : array<string|int, mixed> = = '[]'
Return values
string

resetField()

Reset the state machine for field values

public static resetField() : mixed

richtext()

public static richtext(string $name[, array<string|int, mixed> $unused = = '[]' ][, array<string|int, mixed> $items = = '[]' ]) : string
Parameters
$name : string
$unused : array<string|int, mixed> = = '[]'
$items : array<string|int, mixed> = = '[]'
Return values
string

setData()

Set form per-field values for the fields

public static setData(array<string|int, mixed> $data) : mixed

As form fields are rendered using the Fb class, this method just sets the data there

Parameters
$data : array<string|int, mixed>

In the format Key: (string) Value: (string)

setErrors()

Set per-field error messages to display

public static setErrors(array<string|int, mixed> $errors) : mixed

A given field can have either a single error message or an array of errors The output from the Validator::getFieldErrors method can be used directly as input to this method

Parameters
$errors : array<string|int, mixed>

In the format Key: (string) Value: (string | array of string)

setFieldIdPrefix()

Sets the prefix for generated IDs

public static setFieldIdPrefix(string $prefix) : mixed
Parameters
$prefix : string

The prefix

setFieldNameFormat()

Set a format string which will alter the field name prior to being passed to the underlying render method

public static setFieldNameFormat(string $format) : mixed

Formatting is done using sprintf A single parameter is provided to the sprintf() call, the field name The default format does no transformation, i.e. the string '%s' This parameter persists across multiple form fields

Parameters
$format : string

Format string

Tags
example

Form::setFieldNameFormat('pages[%s]') Form::text('name') // field name will be 'pages[text]'

setFieldValue()

Sets the value for a single field

public static setFieldValue(string $field, string|array<string|int, mixed> $value) : void

As form fields are rendered using the Fb class, this method just sets the data there

Parameters
$field : string

Field name, e.g. 'first_name'

$value : string|array<string|int, mixed>

Field value, e.g. 'John'

simpledaterangepicker()

public static simpledaterangepicker(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

tag()

public static tag(string $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $params = = '[]' ]) : string
Parameters
$name : string
$attrs : array<string|int, mixed> = = '[]'
$params : array<string|int, mixed> = = '[]'
Return values
string

text()

Returns HTML for a text field, using {@see Fb::text} to generate the field itself

public static text(string $name[, array<string|int, mixed> $attrs = [] ]) : string
Parameters
$name : string

The name of the input field

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

Extra attributes for the input field

Return values
string —

HTML

timepicker()

public static timepicker(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $params = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$params : array<string|int, mixed> = = '[]'
Return values
string

totalselector()

public static totalselector(mixed $name[, array<string|int, mixed> $attrs = = '[]' ][, array<string|int, mixed> $options = = '[]' ]) : string
Parameters
$name : mixed
$attrs : array<string|int, mixed> = = '[]'
$options : array<string|int, mixed> = = '[]'
Return values
string

upload()

public static upload(string $name[, array<string|int, mixed> $attrs = = '[]' ]) : string
Parameters
$name : string
$attrs : array<string|int, mixed> = = '[]'
Return values
string

convertFieldName()

Format a field name as per the specification defined by {@see Form::setFieldNameFormat}

protected static convertFieldName(string|null $name) : string
Parameters
$name : string|null

Unformatted field name

Return values
string —

Formatted field name

fieldMethodClass()

Convert a full method name (e.g. Sprout\Helpers\Fb::text) into a friendly class name

protected static fieldMethodClass(string $method) : string

The classes Fb and Form aren't emitted, but all other class names are

Parameters
$method : string

Full original method name, in namespace\class::method format

Return values
string —

HTML-safe name for use in a CSS class

genId()

Generate a unique id which should be stable across calls to this URL as long as the number and order of fields on the page remains the same

protected static genId() : string
Return values
string —

'field?', where ? is an incrementing number starting at zero

passString()

Returns the first argument

protected static passString(string $str) : string

This hacky little method works around the fact that fieldPlain only accepts a method name

Parameters
$str : string
Return values
string
On this page

Search results