\Charcoal\Admin\Property\InputImageInput

Image Property Input

Summary

Methods
Properties
Constants
setStyleAttr()
styleAttr()
setClassAttr()
classAttr()
setWidth()
width()
setHeight()
height()
setMaxWidth()
maxWidth()
setMaxHeight()
maxHeight()
setDependencies()
type()
abridgedInputVal()
filePreview()
previewVal()
setShowFilePreview()
showFilePreview()
setShowFileUpload()
showFileUpload()
setShowFilePicker()
showFilePicker()
setDialogTitle()
dialogTitle()
setChooseButtonLabel()
chooseButtonLabel()
setRemoveButtonLabel()
removeButtonLabel()
__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()
propertyIdent()
setProperty()
property()
p()
renderTranslatableTemplate()
$baseUrl
DEFAULT_INPUT_TYPE
defaultStyleAttr()
parseStyleAttr()
isDataUri()
defaultDialogTitle()
defaultChooseButtonLabel()
defaultRemoveButtonLabel()
createMetadata()
generateInputId()
getter()
setter()
$classAttr
$styleAttr
$width
$height
$maxWidth
$maxHeight
$type
$inputType
$inputMode
$inputName
$inputId
$inputClass
$inputPrefix
$inputSuffix
N/A
camelize()
$showFilePreview
$showFileUpload
$showFilePicker
$dialogTitle
$chooseButtonLabel
$removeButtonLabel
$lang
$ident
$readOnly
$required
$disabled
$multiple
$placeholder
$propertyData
$propertyVal
$property
N/A

Constants

DEFAULT_INPUT_TYPE

DEFAULT_INPUT_TYPE

Properties

$baseUrl

$baseUrl : \Psr\Http\Message\UriInterface|string

The base URI for the Charcoal application.

Type

\Psr\Http\Message\UriInterface|string

$classAttr

$classAttr : string|null

The CSS classes for the HTML `class` attribute.

Type

string|null

$styleAttr

$styleAttr : string|null

The CSS styling declarations for the HTML `style` attribute.

Type

string|null

$width

$width : string

The intrinsic width when displaying the image.

Type

string

$height

$height : string

The intrinsic height when displaying the image.

Type

string

$maxWidth

$maxWidth : string

The maximum width to display the image.

Type

string

$maxHeight

$maxHeight : string

The maximum height to display the image.

Type

string

$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

$showFilePreview

$showFilePreview : boolean

Flag wether the "file preview" should be displayed.

Type

boolean

$showFileUpload

$showFileUpload : boolean

Flag wether the "file upload" input should be displayed.

Type

boolean

$showFilePicker

$showFilePicker : boolean

Flag wether the "file picker" popup button should be displaed.

Type

boolean

$dialogTitle

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

Label for the file picker dialog.

Type

\Charcoal\Translator\Translation|string|null

$chooseButtonLabel

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

Label for the "file picker" button.

Type

\Charcoal\Translator\Translation|string|null

$removeButtonLabel

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

Label for the "remove file" button.

Type

\Charcoal\Translator\Translation|string|null

$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

setStyleAttr()

setStyleAttr(string|array<mixed,string>  $styles) : \Charcoal\Admin\Ui\ImageDisplay

Set the CSS styling declarations to apply on the image.

Parameters

string|array<mixed,string> $styles

An associative array of CSS styles.

Returns

\Charcoal\Admin\Ui\ImageDisplay —

Chainable

styleAttr()

styleAttr() : string

Retrieve the CSS styling declarations for the HTML `style` attribute.

Returns

string

setClassAttr()

setClassAttr(string|array<mixed,string>  $classes) : \Charcoal\Admin\Property\Input\ImageDisplay

Set the CSS classes to apply on the image.

Parameters

string|array<mixed,string> $classes

A space-separated list of CSS classes.

Returns

\Charcoal\Admin\Property\Input\ImageDisplay —

Chainable

classAttr()

classAttr() : string

Retrieve the CSS classes for the HTML `class` attribute.

Returns

string

setWidth()

setWidth(mixed  $width) : \Charcoal\Admin\Ui\ImageDisplay

Set the display width of the image.

If integer specified, 'px' will be append to it.

Parameters

mixed $width

A CSS value; a length, percentage or calc().

Returns

\Charcoal\Admin\Ui\ImageDisplay —

Chainable

width()

width() : string

Retrieve the display width of the image.

Returns

string

setHeight()

setHeight(mixed  $height) : \Charcoal\Admin\Ui\ImageDisplay

Set the display height of the image.

If integer specified, 'px' will be append to it.

Parameters

mixed $height

A CSS value; a length, percentage or calc().

Returns

\Charcoal\Admin\Ui\ImageDisplay —

Chainable

height()

height() : string

Retrieve the display width of the image.

Returns

string

setMaxWidth()

setMaxWidth(mixed  $width) : \Charcoal\Admin\Ui\ImageDisplay

Set the maximum width to display the image.

If integer specified, 'px' will be append to it.

Parameters

mixed $width

A CSS value; a length, percentage or calc().

Returns

\Charcoal\Admin\Ui\ImageDisplay —

Chainable

maxWidth()

maxWidth() : string

Retrieve the maximum width to display the image.

Returns

string

setMaxHeight()

setMaxHeight(mixed  $height) : \Charcoal\Admin\Ui\ImageDisplay

Set the maximum height to display the image.

If integer specified, 'px' will be append to it.

Parameters

mixed $height

A CSS value; a length, percentage or calc().

Returns

\Charcoal\Admin\Ui\ImageDisplay —

Chainable

maxHeight()

maxHeight() : string

Retrieve the maximum height to display the image.

Returns

string

setDependencies()

setDependencies(\Pimple\Container  $container) : void

Inject dependencies from a DI Container.

Parameters

\Pimple\Container $container

A dependencies container instance.

type()

type() : string

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

Returns

string

abridgedInputVal()

abridgedInputVal() : string|null

Returns

string|null

filePreview()

filePreview() : string|null

Returns

string|null

previewVal()

previewVal() : string

Retrieve input value for file preview.

Returns

string

setShowFilePreview()

setShowFilePreview(boolean  $show) : \Charcoal\Admin\Property\Input\FileInput

Parameters

boolean $show

The show file preview flag.

Returns

\Charcoal\Admin\Property\Input\FileInput

Chainable

showFilePreview()

showFilePreview() : boolean

Returns

boolean

setShowFileUpload()

setShowFileUpload(boolean  $show) : \Charcoal\Admin\Property\Input\FileInput

Parameters

boolean $show

The show file upload flag.

Returns

\Charcoal\Admin\Property\Input\FileInput

Chainable

showFileUpload()

showFileUpload() : boolean

Returns

boolean

setShowFilePicker()

setShowFilePicker(boolean  $show) : \Charcoal\Admin\Property\Input\FileInput

Parameters

boolean $show

The show file picker flag.

Returns

\Charcoal\Admin\Property\Input\FileInput

Chainable

showFilePicker()

showFilePicker() : boolean

Returns

boolean

setDialogTitle()

setDialogTitle(string|array<mixed,string>  $title) : self

Set the title for the file picker dialog.

Parameters

string|array<mixed,string> $title

The dialog title.

Returns

self

dialogTitle()

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

Retrieve the title for the file picker dialog.

Returns

\Charcoal\Translator\Translation|string|null

setChooseButtonLabel()

setChooseButtonLabel(string|array<mixed,string>  $label) : self

Set the label for the file picker button.

Parameters

string|array<mixed,string> $label

The button label.

Returns

self

chooseButtonLabel()

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

Retrieve the label for the file picker button.

Returns

\Charcoal\Translator\Translation|string|null

setRemoveButtonLabel()

setRemoveButtonLabel(string|array<mixed,string>  $label) : self

Set the label for the file removal button.

Parameters

string|array<mixed,string> $label

The button label.

Returns

self

removeButtonLabel()

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

Retrieve the label for the file removal button.

Returns

\Charcoal\Translator\Translation|string|null

__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

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.

defaultStyleAttr()

defaultStyleAttr() : string

Parse the CSS styling declarations from the property's display features.

Returns

string

parseStyleAttr()

parseStyleAttr(array<mixed,string>  $styles) : string

Parse the CSS styling declarations from the property's display features.

Parameters

array<mixed,string> $styles

An associative array of CSS styles.

Returns

string

isDataUri()

isDataUri(string  $val) : boolean

Determine if the value is a {@see @see http://en.wikipedia.org/wiki/Data_URI_scheme Data URI}.

Parameters

string $val

A path or URI to analyze.

Returns

boolean

defaultDialogTitle()

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

Retrieve the default title for the file picker dialog.

Returns

\Charcoal\Translator\Translation|string|null

defaultChooseButtonLabel()

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

Retrieve the default label for the file picker button.

Returns

\Charcoal\Translator\Translation|string|null

defaultRemoveButtonLabel()

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

Retrieve the default label for the file removal button.

Returns

\Charcoal\Translator\Translation|string|null

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.

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.