Documentation

select extends helper
in package
Uses iconHelper, valueHelper, selectedHelper, labelFieldSize

Select menu view helper object

Tags
author

Stefan Seehafer sea75300@yahoo.de

copyright

(c) 2011-2020, Stefan Seehafer

license

http://www.gnu.org/licenses/gpl.txt GPLv3

Table of Contents

FIRST_OPTION_DISABLED  = -3
FIRST_OPTION_EMPTY  = -1
FIRST_OPTION_PLEASESELECT  = -2
LABEL_TYPE_DEFAULT  = 'input-group'
LABEL_TYPE_FLOATING  = 'form-floating'
TEXT_DEFAULT_LABEL  = 'LABEL_FIELD_'
$aria  : array<string|int, mixed>
Ement aria config
$autoFocused  : bool
Element is autoFocused
$class  : string
CSS class string
$data  : array<string|int, mixed>
Element data
$fieldSize  : string
Input field size
$firstOption  : int
Is first option auto added
$hasOptGroup  : bool
Select includes opt groups
$icon  : string
Icon class
$iconOnly  : bool
Show icon only
$iconStack  : string
Button text
$id  : string
Element ID
$isMultiple  : bool
Select multiple options
$labelClass  : string
CS class for label
$labelSize  : string
Label size string
$labelType  : string
Column with if input uses an icon
$language  : language
Language object
$name  : string
Element name
$options  : array<string|int, mixed>
Select options
$prefix  : string
Element prefix
$prependLabel  : bool
Prepend label to selectbox
$readonly  : bool
Element is readonly
$requ  : bool
Element is required
$returned  : bool
Flag if element string was return by @see __toString
$returnString  : string
Option return string
$selected  : string|array<string|int, mixed>
Element value
$size  : string
Button text
$spinner  : string
Spinner class for icon
$stackTop  : bool
Move stack icon to top
$text  : string
Input label
$useWrapper  : string
Add div wrapper to input field
$value  : string
Element value
$wrapperClass  : string
CSS class for div wrapper
$sizeMap  : array<string|int, mixed>
Size map
__construct()  : mixed
Konstruktor
getCleanName()  : string
Name cleanup from bracket, etc.
getFieldSize()  : string
Fetch field size classes
getIdString()  : string
Returns name and ID string
getJsLangVars()  : void
Returns optional JavaScript language vars
getJsVars()  : void
Returns optional JavaScript vars
getLabelSize()  : string
Fetch label size classes
initFromYml()  : bool
prependLabel()  : $this
Prepend label to select menu
setAria()  : $this
Add array for 'data-'-params to element
setAutoFocused()  : $this
Make helper auto focused
setClass()  : $this
Set additional css class
setData()  : $this
Add array for 'data-'-params to element
setDisplaySizes()  : $this
Sets label and field sizes
setDisplaySizesDefault()  : $this
Sets default label and field sizes values, Label: xs: 12, sm: 6, md: 5 Fields: xs: 12, sm: 6, md: 7
setFieldSize()  : $this
Sets field sizes only
setFirstOption()  : $this
Select auto-added first option, values are fpcm\view\helper\select::FIRST_OPTION_EMPTY, fpcm\view\helper\select::FIRST_OPTION_PLEASESELECT, fpcm\view\helper\select::FIRST_OPTION_DISABLED
setIcon()  : $this
Set icon
setIconOnly()  : $this
Set button to display icon only
setIsMultiple()  : $this
Enable multiple selection
setLabelClass()  : $this
Set label class CSS string
setLabelSize()  : $this
Sets label sizes only
setLabelTypeFloat()  : $this
Set label typ to floating
setOptGroup()  : $this
Enables opt group for select element
setOptions()  : $this
Set options for selectbox
setReadonly()  : $this
Set element to readonly
setRequired()  : $this
Set required flag
setReturned()  : $this
Prevents rendering of view helper at the end of PHP proessing
setSelected()  : $this
Set preselected value
setSize()  : $this
Set Icon size
setSpinner()  : $this
Set flag icon has spinner
setStack()  : $this
Set if icon is stacked
setStackTop()  : $this
Move stack icon to top
setText()  : $this
Set button description
setValue()  : $this
Set input value
setWidth()  : $this
Set with of select menu
setWrapper()  : $this
Use div wrapper around input field
setWrapperClass()  : $this
Set wrapper css class
getAriaString()  : string
Return class string
getAutoFocusedString()  : string
Return autofocused string
getClassString()  : string
Return class string
getDataString()  : string
Return class string
getDescriptionTextString()  : string
Returns name and ID string
getFirstOption()  : bool
Return first option string
getIconString()  : string
Return full icon string
getNameIdString()  : string
Returns name and ID string
getOptionsGroupsString()  : string
Create options string
getOptionsString()  : string|void
Create options string
getReadonlyString()  : string
Return class string
getSelectedString()  : string
Return selected string
getString()  : string
Return element string
getValueString()  : string
Return value string
init()  : void
Optional init function
initLabel()  : bool
Initialized default label by field name
assocArrayToString()  : string
Turns assoc array into string
mapSizes()  : bool
Maps indices to sizeMap

Constants

FIRST_OPTION_DISABLED

public mixed FIRST_OPTION_DISABLED = -3

FIRST_OPTION_EMPTY

public mixed FIRST_OPTION_EMPTY = -1

FIRST_OPTION_PLEASESELECT

public mixed FIRST_OPTION_PLEASESELECT = -2

LABEL_TYPE_DEFAULT

public mixed LABEL_TYPE_DEFAULT = 'input-group'

LABEL_TYPE_FLOATING

public mixed LABEL_TYPE_FLOATING = 'form-floating'

TEXT_DEFAULT_LABEL

public mixed TEXT_DEFAULT_LABEL = 'LABEL_FIELD_'

Properties

$aria

Ement aria config

protected array<string|int, mixed> $aria = []
Tags
since
5.0-dev

$autoFocused

Element is autoFocused

protected bool $autoFocused = false
Tags
since
4.1

$data

Element data

protected array<string|int, mixed> $data = []

$firstOption

Is first option auto added

protected int $firstOption

$hasOptGroup

Select includes opt groups

protected bool $hasOptGroup = false

$iconOnly

Show icon only

protected bool $iconOnly = false

$iconStack

Button text

protected string $iconStack = ''

$id

Element ID

protected string $id = ''

$isMultiple

Select multiple options

protected bool $isMultiple = false

$labelClass

CS class for label

protected string $labelClass = ''
Tags
since
4.1

$labelType

Column with if input uses an icon

protected string $labelType = 'input-group'

$name

Element name

protected string $name = ''

$options

Select options

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

$prefix

Element prefix

protected string $prefix = ''

$prependLabel

Prepend label to selectbox

protected bool $prependLabel = false

$readonly

Element is readonly

protected bool $readonly = false

$requ

Element is required

protected bool $requ = false
Tags
since
5.0.0-a3

$returned

Flag if element string was return by @see __toString

protected bool $returned = false

$returnString

Option return string

protected string $returnString = []

$selected

Element value

protected string|array<string|int, mixed> $selected = ''

$spinner

Spinner class for icon

protected string $spinner = ''
Tags
since
4.2

$stackTop

Move stack icon to top

protected bool $stackTop = false

$text

Input label

protected string $text = ''

$useWrapper

Add div wrapper to input field

protected string $useWrapper = false

$wrapperClass

CSS class for div wrapper

protected string $wrapperClass = ''

$sizeMap

Size map

private array<string|int, mixed> $sizeMap = [0 => 'col-', 1 => 'col-sm-', 2 => 'col-md-', 3 => 'col-lg-', 4 => 'col-xl-', 'xs' => 'col-', 'sm' => 'col-sm-', 'md' => 'col-md-', 'lg' => 'col-lg-', 'xl' => 'col-xl-']

Methods

__construct()

Konstruktor

public __construct(string $name[, string $id = '' ]) : mixed
Parameters
$name : string
$id : string = ''
Return values
mixed

getCleanName()

Name cleanup from bracket, etc.

public final getCleanName() : string
Return values
string

getFieldSize()

Fetch field size classes

public getFieldSize() : string
Tags
deprecated
5.0-dev
Return values
string

getIdString()

Returns name and ID string

public final getIdString() : string
Return values
string

getJsLangVars()

Returns optional JavaScript language vars

public getJsLangVars() : void
Return values
void

getJsVars()

Returns optional JavaScript vars

public getJsVars() : void
Return values
void

getLabelSize()

Fetch label size classes

public getLabelSize() : string
Return values
string

initFromYml()

public final initFromYml(array<string|int, mixed> $param, array<string|int, mixed> $viewVars) : bool
Parameters
$param : array<string|int, mixed>
$viewVars : array<string|int, mixed>
Tags
since
4.5
Return values
bool

prependLabel()

Prepend label to select menu

public prependLabel() : $this
Tags
since
4.5
Return values
$this

setAria()

Add array for 'data-'-params to element

public setAria(array<string|int, mixed> $aria) : $this
Parameters
$aria : array<string|int, mixed>
Return values
$this

setAutoFocused()

Make helper auto focused

public setAutoFocused(bool $autoFocused) : $this
Parameters
$autoFocused : bool
Tags
since
4.1
Return values
$this

setClass()

Set additional css class

public setClass(string $class) : $this
Parameters
$class : string
Return values
$this

setData()

Add array for 'data-'-params to element

public setData(array<string|int, mixed> $data) : $this
Parameters
$data : array<string|int, mixed>
Return values
$this

setDisplaySizes()

Sets label and field sizes

public setDisplaySizes(array<string|int, mixed> $label[, array<string|int, mixed> $field = [] ]) : $this
Parameters
$label : array<string|int, mixed>
$field : array<string|int, mixed> = []

(@deprecated 5.0-dev)

Return values
$this

setDisplaySizesDefault()

Sets default label and field sizes values, Label: xs: 12, sm: 6, md: 5 Fields: xs: 12, sm: 6, md: 7

public setDisplaySizesDefault() : $this
Return values
$this

setFieldSize()

Sets field sizes only

public setFieldSize(array<string|int, mixed> $fieldSizes) : $this
Parameters
$fieldSizes : array<string|int, mixed>
Tags
deprecated
5.0-dev
Return values
$this

setFirstOption()

Select auto-added first option, values are fpcm\view\helper\select::FIRST_OPTION_EMPTY, fpcm\view\helper\select::FIRST_OPTION_PLEASESELECT, fpcm\view\helper\select::FIRST_OPTION_DISABLED

public setFirstOption(int $firstOption) : $this
Parameters
$firstOption : int
Return values
$this

setIcon()

Set icon

public setIcon(string $icon[, string $prefix = 'fa' ][, bool $useFa = true ]) : $this
Parameters
$icon : string

Icon CSS classes

$prefix : string = 'fa'

Icon prefix

$useFa : bool = true

Auto-add FontAwesome Icon classes

Return values
$this

setIconOnly()

Set button to display icon only

public setIconOnly(string $iconOnly) : $this
Parameters
$iconOnly : string
Return values
$this

setIsMultiple()

Enable multiple selection

public setIsMultiple(bool $isMultiple) : $this
Parameters
$isMultiple : bool
Return values
$this

setLabelClass()

Set label class CSS string

public setLabelClass(string $labelClass) : $this
Parameters
$labelClass : string
Tags
since
4.1
Return values
$this

setLabelSize()

Sets label sizes only

public setLabelSize(array<string|int, mixed> $labelSizes) : $this
Parameters
$labelSizes : array<string|int, mixed>
Return values
$this

setLabelTypeFloat()

Set label typ to floating

public setLabelTypeFloat() : $this
Tags
since
5.0.0-b4
Return values
$this

setOptGroup()

Enables opt group for select element

public setOptGroup(bool $hasGroup) : $this
Parameters
$hasGroup : bool
Return values
$this

setOptions()

Set options for selectbox

public setOptions(array<string|int, mixed> $options) : $this
Parameters
$options : array<string|int, mixed>
Return values
$this

setReadonly()

Set element to readonly

public setReadonly(bool $readonly) : $this
Parameters
$readonly : bool
Return values
$this

setRequired()

Set required flag

public setRequired(bool $requ) : $this
Parameters
$requ : bool
Tags
since
5.0.0-a3
Return values
$this

setReturned()

Prevents rendering of view helper at the end of PHP proessing

public setReturned(bool $returned) : $this
Parameters
$returned : bool
Return values
$this

setSelected()

Set preselected value

public setSelected(string|int|array<string|int, mixed> $selected) : $this
Parameters
$selected : string|int|array<string|int, mixed>
Return values
$this

setSize()

Set Icon size

public setSize(string $size[, bool $useFa = true ]) : $this
Parameters
$size : string
$useFa : bool = true

Auto-add FontAwesome Icon classes

Return values
$this

setSpinner()

Set flag icon has spinner

public setSpinner(string $spinner[, bool $useFa = true ]) : $this
Parameters
$spinner : string
$useFa : bool = true
Return values
$this

setStack()

Set if icon is stacked

public setStack(string $iconStack[, bool $useFa = true ]) : $this
Parameters
$iconStack : string
$useFa : bool = true

Auto-add FontAwesome Icon classes

Return values
$this

setStackTop()

Move stack icon to top

public setStackTop(bool $stackTop) : $this
Parameters
$stackTop : bool
Return values
$this

setText()

Set button description

public final setText(string $text[, array<string|int, mixed> $params = [] ]) : $this
Parameters
$text : string
$params : array<string|int, mixed> = []
Return values
$this

setValue()

Set input value

public setValue(mixed $value[, int $escapeMode = null ]) : $this
Parameters
$value : mixed
$escapeMode : int = null
Return values
$this

setWidth()

Set with of select menu

public setWidth(int $width) : $this
Parameters
$width : int
Return values
$this

setWrapper()

Use div wrapper around input field

public setWrapper(bool $useWrapper) : $this
Parameters
$useWrapper : bool
Return values
$this

setWrapperClass()

Set wrapper css class

public setWrapperClass(string $wrapperClass) : $this
Parameters
$wrapperClass : string
Return values
$this

getAriaString()

Return class string

protected getAriaString() : string
Return values
string

getAutoFocusedString()

Return autofocused string

protected getAutoFocusedString() : string
Return values
string

getClassString()

Return class string

protected getClassString() : string
Return values
string

getDataString()

Return class string

protected getDataString() : string
Return values
string

getDescriptionTextString()

Returns name and ID string

protected final getDescriptionTextString([string $prefix = 'ps-1' ]) : string
Parameters
$prefix : string = 'ps-1'
Return values
string

getFirstOption()

Return first option string

protected getFirstOption() : bool
Return values
bool

getIconString()

Return full icon string

protected getIconString() : string
Return values
string

getNameIdString()

Returns name and ID string

protected getNameIdString() : string
Return values
string

getOptionsGroupsString()

Create options string

protected getOptionsGroupsString() : string
Return values
string

getOptionsString()

Create options string

protected getOptionsString(array<string|int, mixed> $options) : string|void
Parameters
$options : array<string|int, mixed>
Return values
string|void

getReadonlyString()

Return class string

protected getReadonlyString() : string
Return values
string

getSelectedString()

Return selected string

protected getSelectedString() : string
Return values
string

getString()

Return element string

protected getString() : string
Return values
string

getValueString()

Return value string

protected getValueString() : string
Return values
string

init()

Optional init function

protected init() : void
Return values
void

initLabel()

Initialized default label by field name

protected final initLabel() : bool
Tags
since
4.3.0
Return values
bool

assocArrayToString()

Turns assoc array into string

private assocArrayToString(string $prefix, array<string|int, mixed> $data) : string
Parameters
$prefix : string
$data : array<string|int, mixed>
Return values
string

mapSizes()

Maps indices to sizeMap

private mapSizes(string|int &$size, string|int $index) : bool
Parameters
$size : string|int
$index : string|int
Return values
bool

Search results