\Charcoal\Admin\Property\Input\SelectizeEmailInput

Email Input Selectize

The HTML form control can be either an <input type="text"> (for multiple values) or a <select> (single value).

Summary

Methods
Properties
Constants
setDependencies()
modelFactory()
choices()
inputGroup()
setAllowClipboardCopy()
allowClipboardCopy()
setAllowUpdate()
allowUpdate()
deferred()
setDeferred()
formIdent()
setFormIdent()
formIdentAsJson()
setSelectizeOptions()
mergeSelectizeOptions()
addSelectizeOption()
selectizeOptions()
defaultSelectizeOptions()
selectizeOptionsAsJson()
isObject()
defaultChoiceObjMap()
setSelectOptions()
mergeSelectOptions()
addSelectOption()
selectOptions()
defaultSelectOptions()
selectOptionsAsJson()
isChoiceSelected()
setEmptyChoice()
emptyChoice()
mapObjToChoice()
setChoiceObjMap()
choiceObjMap()
inputNameFallback()
__construct()
setData()
setPropertyVal()
propertyVal()
setLang()
lang()
hidden()
setIdent()
ident()
setReadOnly()
readOnly()
setRequired()
required()
setDisabled()
disabled()
setMultiple()
multiple()
setPlaceholder()
placeholder()
setInputId()
inputId()
setInputClass()
inputClass()
setInputName()
inputName()
inputVal()
setInputMode()
inputMode()
setInputType()
inputType()
hasInputAffix()
setInputPrefix()
inputPrefix()
setInputSuffix()
inputSuffix()
setType()
type()
propertyIdent()
setProperty()
property()
p()
renderTranslatableTemplate()
No public properties found
DEFAULT_INPUT_TYPE
setModelFactory()
collectionLoader()
parseSelectizeOptions()
parseChoice()
parseChoiceVal()
defaultEmptyChoice()
createMetadata()
generateInputId()
getter()
setter()
$allowClipboardCopy
$allowUpdate
$emptyChoice
$choiceObjMap
$type
$inputType
$inputMode
$inputName
$inputId
$inputClass
$inputPrefix
$inputSuffix
N/A
setCollectionLoader()
selectizeVal()
camelize()
$selectizeOptions
$modelFactory
$collectionLoader
$deferred
$formIdent
$selectOptions
$lang
$ident
$readOnly
$required
$disabled
$multiple
$placeholder
$propertyData
$propertyVal
$property
N/A

Constants

DEFAULT_INPUT_TYPE

DEFAULT_INPUT_TYPE

Properties

$allowClipboardCopy

$allowClipboardCopy : boolean

Whether to show a button to copy items to clipboard.

Type

boolean

$allowUpdate

$allowUpdate : boolean

Whether to show a button to allow update items.

Type

boolean

$emptyChoice

$emptyChoice : array

The empty (NULL) option.

Type

array

$choiceObjMap

$choiceObjMap : array

The object-to-choice map.

Type

array

$type

$type : string

The control type for the HTML element `<input>`.

Type

string

$inputType

$inputType : string

Type

string

$inputMode

$inputMode : string

Type

string

$inputName

$inputName : string

Type

string

$inputId

$inputId : string

Type

string

$inputClass

$inputClass : string

Type

string

$inputPrefix

$inputPrefix : \Charcoal\Translator\Translation|string|null

The control's prefix.

Type

\Charcoal\Translator\Translation|string|null

$inputSuffix

$inputSuffix : \Charcoal\Translator\Translation|string|null

The control's suffix.

Type

\Charcoal\Translator\Translation|string|null

$selectizeOptions

$selectizeOptions : array

Settings for {@link http://selectize.github.io/selectize.js/ Selectize.js}

Type

array

$modelFactory

$modelFactory : \Charcoal\Factory\FactoryInterface

Store the factory instance for the current class.

Type

\Charcoal\Factory\FactoryInterface

$collectionLoader

$collectionLoader : \Charcoal\Loader\CollectionLoader

Store the collection loader for the current class.

Type

\Charcoal\Loader\CollectionLoader

$deferred

$deferred : boolean

Should the object be loaded in deferred mode.

Type

boolean

$formIdent

$formIdent : mixed

The form idents to use while creating objects through Selectize.

Can either be a single value, or an array of values for these idents

  • 'create'
  • 'update'

Type

mixed

$selectOptions

$selectOptions : array

Settings for {@link http://silviomoreto.github.io/bootstrap-select/ Bootstrap Select}.

Type

array

$lang

$lang : string

Type

string

$ident

$ident : string

Type

string

$readOnly

$readOnly : boolean

Type

boolean

$required

$required : boolean

Type

boolean

$disabled

$disabled : boolean

Type

boolean

$multiple

$multiple : boolean

Type

boolean

$placeholder

$placeholder : \Charcoal\Translator\Translation|string|null

Type

\Charcoal\Translator\Translation|string|null

$propertyData

$propertyData : array

Type

array

$propertyVal

$propertyVal : mixed

Type

mixed

$property

$property : \Charcoal\Property\PropertyInterface

Type

\Charcoal\Property\PropertyInterface

Methods

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Inject dependencies from a DI Container.

Parameters

\Pimple\Container $container

A dependencies container instance.

modelFactory()

modelFactory() : \Charcoal\Factory\FactoryInterface

Retrieve the object model factory.

Throws

\RuntimeException

If the model factory was not previously set.

Returns

\Charcoal\Factory\FactoryInterface

choices()

choices() : \Charcoal\Admin\Property\Generator|array

Retrieve the selectable options.

Returns

\Charcoal\Admin\Property\Generator|array

inputGroup()

inputGroup() : boolean

Create an input group to nest extra inputs alongside selectize

Returns

boolean

setAllowClipboardCopy()

setAllowClipboardCopy(boolean  $flag) : \Charcoal\Admin\Property\Input\UiItemInterface

Show/hide the "Copy to Clipboard" button.

Parameters

boolean $flag

Show (TRUE) or hide (FALSE) the copy button.

Returns

\Charcoal\Admin\Property\Input\UiItemInterface —

Chainable

allowClipboardCopy()

allowClipboardCopy() : boolean

Determine if the property allows "Copy to Clipboard".

Returns

boolean

setAllowUpdate()

setAllowUpdate(boolean  $allowUpdate) : self

Parameters

boolean $allowUpdate

Show (TRUE) or hide (FALSE) the update button.

Returns

self

allowUpdate()

allowUpdate() : boolean

Determine if the property allows "Update items".

Returns

boolean

deferred()

deferred() : boolean

Returns

boolean

setDeferred()

setDeferred(boolean  $deferred) : self

Parameters

boolean $deferred

Should the object be loaded in deferred mode.

Returns

self

formIdent()

formIdent() : mixed

Returns

mixed

setFormIdent()

setFormIdent(mixed  $formIdent) : self

Parameters

mixed $formIdent

The form ident(s) for object creation and modification.

Returns

self

formIdentAsJson()

formIdentAsJson() : string

Returns

string —

Returns data serialized with {@see json_encode()}.

setSelectizeOptions()

setSelectizeOptions(array  $settings) : \Charcoal\Admin\Property\Input\TagsInput

Set the selectize picker's options.

This method overwrites existing helpers.

Parameters

array $settings

The selectize picker options.

Returns

\Charcoal\Admin\Property\Input\TagsInput —

Chainable

mergeSelectizeOptions()

mergeSelectizeOptions(array  $settings) : \Charcoal\Admin\Property\Input\TagsInput

Merge (replacing or adding) selectize picker options.

Parameters

array $settings

The selectize picker options.

Returns

\Charcoal\Admin\Property\Input\TagsInput —

Chainable

addSelectizeOption()

addSelectizeOption(string  $key, mixed  $val) : self

Add (or replace) an selectize picker option.

Parameters

string $key

The setting to add/replace.

mixed $val

The setting's value to apply.

Throws

\InvalidArgumentException

If the identifier is not a string.

Returns

self —

Chainable

selectizeOptions()

selectizeOptions() : array

Retrieve the selectize picker's options.

Returns

array

defaultSelectizeOptions()

defaultSelectizeOptions() : array

Retrieve the default selectize picker options.

Returns

array

selectizeOptionsAsJson()

selectizeOptionsAsJson() : string

Retrieve the selectize picker's options as a JSON string.

Returns

string —

Returns data serialized with {@see json_encode()}.

isObject()

isObject() : boolean

Returns

boolean

defaultChoiceObjMap()

defaultChoiceObjMap() : array

Retrieve the default object-to-choice data map.

Returns

array

setSelectOptions()

setSelectOptions(array  $settings) : \Charcoal\Admin\Property\Input\Selectinput

Set the select picker's options.

This method always merges default settings.

Parameters

array $settings

The select picker options.

Returns

\Charcoal\Admin\Property\Input\Selectinput —

Chainable

mergeSelectOptions()

mergeSelectOptions(array  $settings) : \Charcoal\Admin\Property\Input\Selectinput

Merge (replacing or adding) select picker options.

Parameters

array $settings

The select picker options.

Returns

\Charcoal\Admin\Property\Input\Selectinput —

Chainable

addSelectOption()

addSelectOption(string  $key, mixed  $val) : \Charcoal\Admin\Property\Input\Selectinput

Add (or replace) an select picker option.

Parameters

string $key

The setting to add/replace.

mixed $val

The setting's value to apply.

Throws

\InvalidArgumentException

If the identifier is not a string.

Returns

\Charcoal\Admin\Property\Input\Selectinput —

Chainable

selectOptions()

selectOptions() : array

Retrieve the select picker's options.

Returns

array

defaultSelectOptions()

defaultSelectOptions() : array

Retrieve the default select picker options.

Returns

array

selectOptionsAsJson()

selectOptionsAsJson() : string

Retrieve the select picker's options as a JSON string.

Returns

string —

Returns data serialized with {@see json_encode()}.

isChoiceSelected()

isChoiceSelected(mixed  $choice) : boolean

Determine if the provided option is a selected value.

Parameters

mixed $choice

The choice to check.

Returns

boolean

setEmptyChoice()

setEmptyChoice(array|string  $choice) : \Charcoal\Admin\Property\PropertyInputInterface

Set the empty option's structure.

Parameters

array|string $choice

The property value.

Throws

\InvalidArgumentException

If the choice structure is invalid.

Returns

\Charcoal\Admin\Property\PropertyInputInterface

Chainable

emptyChoice()

emptyChoice() : array|null

Retrieve the empty option structure.

Returns

array|null

mapObjToChoice()

mapObjToChoice(array|\ArrayAccess  $obj) : array

Convert the given object into a choice structure.

Parameters

array|\ArrayAccess $obj

The object to map to a choice.

Returns

array

setChoiceObjMap()

setChoiceObjMap(array  $map) : \Charcoal\Admin\Property\TagsInput

Set the object-to-choice data map.

Parameters

array $map

Model-to-choice mapping.

Returns

\Charcoal\Admin\Property\TagsInput —

Chainable

choiceObjMap()

choiceObjMap() : array

Retrieve the object-to-choice data map.

Returns

array —

Returns a data map to abide.

inputNameFallback()

inputNameFallback() : string

Retrieve the property input name without `[]` as fallback.

This allows to submit empty value from select input while preventing submitting the fallback when the property is multiple.

Returns

string

__construct()

__construct(array|\ArrayAccess  $data = null) 

Parameters

array|\ArrayAccess $data

Constructor data.

setData()

setData(array  $data) : \Charcoal\Admin\Property\AbstractPropertyInput

This function takes an array and fill the model object with its value.

This method either calls a setter for each key (set_{$key}()) or sets a public member.

For example, calling with setData(['properties'=>$properties]) would call setProperties($properties), becasue setProperties() exists.

But calling with setData(['foobar'=>$foo]) would set the $foobar member on the metadata object, because the method set_foobar() does not exist.

Parameters

array $data

The input data.

Returns

\Charcoal\Admin\Property\AbstractPropertyInput

Chainable

propertyVal()

propertyVal() : mixed

Returns

mixed

lang()

lang() : string

Get the input language

Returns

string

hidden()

hidden() : boolean

Returns

boolean

setIdent()

setIdent(string  $ident) : \Charcoal\Admin\Property\Widget

Parameters

string $ident

Input identifier.

Throws

\InvalidArgumentException

If the ident is not a string.

Returns

\Charcoal\Admin\Property\Widget —

Chainable

ident()

ident() : string

Returns

string

setReadOnly()

setReadOnly(boolean  $readOnly) : \Charcoal\Admin\Property\Widget

Parameters

boolean $readOnly

The read-only flag.

Returns

\Charcoal\Admin\Property\Widget —

(Chainable)

readOnly()

readOnly() : boolean

Returns

boolean

setRequired()

setRequired(boolean  $required) : \Charcoal\Admin\Property\Widget

Parameters

boolean $required

Required flag.

Returns

\Charcoal\Admin\Property\Widget —

(Chainable)

required()

required() : boolean

Returns

boolean

setDisabled()

setDisabled(boolean  $disabled) : \Charcoal\Admin\Property\Widget

Parameters

boolean $disabled

Disabled flag.

Returns

\Charcoal\Admin\Property\Widget —

(Chainable)

disabled()

disabled() : boolean

Returns

boolean

setMultiple()

setMultiple(boolean  $multiple) : \Charcoal\Admin\Property\Widget

Parameters

boolean $multiple

Multiple flag.

Returns

\Charcoal\Admin\Property\Widget —

(Chainable)

multiple()

multiple() : boolean

Returns

boolean

setPlaceholder()

setPlaceholder(mixed  $placeholder) : \Charcoal\Admin\Property\AbstractPropertyInput

Set the form control's placeholder.

A placeholder is a hint to the user of what can be entered in the property control.

Parameters

mixed $placeholder

The placeholder attribute.

Returns

\Charcoal\Admin\Property\AbstractPropertyInput

Chainable

placeholder()

placeholder() : \Charcoal\Translator\Translation|string|null

Retrieve the placeholder.

Returns

\Charcoal\Translator\Translation|string|null

setInputId()

setInputId(string  $inputId) : \Charcoal\Admin\Property\AbstractPropertyInput

Set the input ID.

Used for the HTML "ID" attribute.

Parameters

string $inputId

HTML input id attribute.

Returns

\Charcoal\Admin\Property\AbstractPropertyInput

Chainable

inputId()

inputId() : string

Retrieve the input ID.

If none was previously set then a unique random one will be generated.

Returns

string

setInputClass()

setInputClass(string  $inputClass) : \Charcoal\Admin\Property\AbstractPropertyInput

Parameters

string $inputClass

The input class attribute.

Throws

\InvalidArgumentException

If the class is not a string.

Returns

\Charcoal\Admin\Property\AbstractPropertyInput

Chainable

inputClass()

inputClass() : string

Returns

string

setInputName()

setInputName(string  $inputName) : \Charcoal\Admin\Property\AbstractPropertyInput

Set the input name.

Used for the HTML "name" attribute.

Parameters

string $inputName

HTML input id attribute.

Returns

\Charcoal\Admin\Property\AbstractPropertyInput

Chainable

inputName()

inputName() : string

Retrieve the input name.

The input name should always be the property's ident.

Returns

string

inputVal()

inputVal() : string

Throws

\UnexpectedValueException

If the value is invalid.

Returns

string

setInputMode()

setInputMode(string  $inputMode) : \Charcoal\Admin\Property\AbstractPropertyInput

Set the hint to the browser for which keyboard to display.

Parameters

string $inputMode

The input type.

Throws

\InvalidArgumentException

If the provided argument is not a string.

Returns

\Charcoal\Admin\Property\AbstractPropertyInput

Chainable

inputMode()

inputMode() : string

Retrieve the hint to the browser for which keyboard to display.

Returns

string

setInputType()

setInputType(string  $inputType) : \Charcoal\Admin\Property\AbstractPropertyInput

Parameters

string $inputType

The input type.

Throws

\InvalidArgumentException

If the provided argument is not a string.

Returns

\Charcoal\Admin\Property\AbstractPropertyInput

Chainable

inputType()

inputType() : string

Returns

string

hasInputAffix()

hasInputAffix() : boolean

Determine if the property has an affix.

Textual <input>s only

Avoid using <select> elements here as they cannot be fully styled in WebKit browsers.

Avoid using <textarea> elements here as their rows attribute will not be respected in some cases.

Returns

boolean

setInputPrefix()

setInputPrefix(mixed  $affix) : self

Retrieve the control's prefix.

Parameters

mixed $affix

Text to display before the control.

Throws

\InvalidArgumentException

If the suffix is not translatable.

Returns

self

inputPrefix()

inputPrefix() : \Charcoal\Translator\Translation|string|null

Retrieve the control's prefix.

Returns

\Charcoal\Translator\Translation|string|null

setInputSuffix()

setInputSuffix(mixed  $affix) : self

Retrieve the control's suffix.

Parameters

mixed $affix

Text to display after the control.

Throws

\InvalidArgumentException

If the suffix is not translatable.

Returns

self

inputSuffix()

inputSuffix() : \Charcoal\Translator\Translation|string|null

Retrieve the control's suffix.

Returns

\Charcoal\Translator\Translation|string|null

setType()

setType(string  $type) : \Charcoal\Admin\Property\AbstractPropertyInput

Set the control type for the HTML element `<input>`.

Parameters

string $type

The control type.

Throws

\InvalidArgumentException

If the provided argument is not a string.

Returns

\Charcoal\Admin\Property\AbstractPropertyInput

Chainable

type()

type() : string

Retrieve the control type for the HTML element `<input>`.

Returns

string

propertyIdent()

propertyIdent() : string

Returns

string

setProperty()

setProperty(\Charcoal\Property\PropertyInterface  $p) : \Charcoal\Admin\Property\AbstractPropertyInput

Parameters

\Charcoal\Property\PropertyInterface $p

The property.

Returns

\Charcoal\Admin\Property\AbstractPropertyInput

Chainable

property()

property() : \Charcoal\Property\PropertyInterface

Returns

\Charcoal\Property\PropertyInterface

p()

p() : \Charcoal\Property\PropertyInterface

Alias of {@see self::property()}

Returns

\Charcoal\Property\PropertyInterface

renderTranslatableTemplate()

renderTranslatableTemplate(mixed  $templateString) : string

Render the given template from string.

Parameters

mixed $templateString

The template to render.

Returns

string —

The rendered template.

setModelFactory()

setModelFactory(\Charcoal\Factory\FactoryInterface  $factory) : self

Set an object model factory.

Parameters

\Charcoal\Factory\FactoryInterface $factory

The model factory, to create objects.

Returns

self

collectionLoader()

collectionLoader() : \Charcoal\Loader\CollectionLoader

Retrieve the model collection loader.

Throws

\RuntimeException

If the collection loader was not previously set.

Returns

\Charcoal\Loader\CollectionLoader

parseSelectizeOptions()

parseSelectizeOptions(array  $settings) : array

Parse the selectize picker's options.

Parameters

array $settings

The selectize picker options.

Returns

array —

Returns the parsed options.

parseChoice()

parseChoice(string|integer  $ident, array|object  $choice) : array|null

Prepare a single selectable option for output.

Parameters

string|integer $ident

The choice key.

array|object $choice

The choice structure.

Returns

array|null

parseChoiceVal()

parseChoiceVal(mixed  $value) : mixed

Convert the value to a scalar.

Parameters

mixed $value

A value to parse.

Returns

mixed

defaultEmptyChoice()

defaultEmptyChoice() : array

Retrieve the default empty option structure.

Returns

array

createMetadata()

createMetadata(array  $data = null) : \Charcoal\Property\PropertyMetadata

Parameters

array $data

Optional. Metadata data.

Returns

\Charcoal\Property\PropertyMetadata

generateInputId()

generateInputId() : string

Generate a unique input ID.

Returns

string

getter()

getter(string  $key) : string

Allow an object to define how the key getter are called.

Parameters

string $key

The key to get the getter from.

Returns

string —

The getter method name, for a given key.

setter()

setter(string  $key) : string

Allow an object to define how the key setter are called.

Parameters

string $key

The key to get the setter from.

Returns

string —

The setter method name, for a given key.

setCollectionLoader()

setCollectionLoader(\Charcoal\Loader\CollectionLoader  $loader) : self

Set a model collection loader.

Parameters

\Charcoal\Loader\CollectionLoader $loader

The collection loader.

Returns

self

selectizeVal()

selectizeVal(mixed  $val = null, array  $options = array()) : array

Convert the given value into selectize picker choices.

Parameters

mixed $val

The value to parse into selectize choices.

array $options

Optional structure options.

Returns

array

camelize()

camelize(string  $str) : string

Transform a snake_case string to camelCase.

Parameters

string $str

The snake_case string to camelize.

Returns

string —

The camelCase string.