MediaField

Extends \Joomla\CMS\Form\FormField

Provides a modal media selector including upload mechanism

since

1.6

Methods

__construct

Method to instantiate the form field object.

__construct(\Joomla\CMS\Form\Form $form = null) 
inherited
since

1.7.0

Arguments

$form

\Joomla\CMS\Form\FormThe form to attach to the form field object.

__get

Method to get certain otherwise inaccessible properties from the form field object.

__get(string $name) : mixed
inherited
since

1.7.0

Arguments

$name

stringThe property name for which to get the value.

Response

mixedThe property value or null.

__set

Method to set certain otherwise inaccessible properties of the form field object.

__set(string $name, mixed $value) : void
inherited
since

3.2

Arguments

$name

stringThe property name for which to set the value.

$value

mixedThe value of the property.

getAttribute

Method to get an attribute of the field

getAttribute(string $name, mixed $default = null) : mixed
inherited
since

3.2

Arguments

$name

stringName of the attribute to get

$default

mixedOptional value to return if attribute not found

Response

mixedValue of the attribute / default

getControlGroup

Method to get a control group with label and input.

getControlGroup() : string
inherited deprecated
since

3.2

deprecated

3.2.3 Use renderField() instead

Response

stringA string containing the html for the control group

getFieldName

Method to get the field name used.

getFieldName(string $fieldName) : string
inherited
since

1.7.0

Arguments

$fieldName

stringThe field element name.

Response

stringThe field name

getId

Method to get the id used for the field input tag.

getId(string $fieldId, string $fieldName) : string
inherited
since

1.7.0

Arguments

$fieldId

stringThe field element id.

$fieldName

stringThe field element name.

Response

stringThe id to be used for the field input tag.

getInput

Method to get the field input markup.

getInput() : string
inherited
since

1.7.0

Response

stringThe field input markup.

getLabel

Method to get the field label markup.

getLabel() : string
inherited
since

1.7.0

Response

stringThe field label markup.

getLayoutData

Method to get the data to be passed to the layout for rendering.

getLayoutData() : array
inherited
since

3.5

Response

array

getLayoutPaths

Allow to override renderer include paths in child fields

getLayoutPaths() : array
inherited
since

3.5

Response

array

getName

Method to get the name used for the field input tag.

getName(string $fieldName) : string
inherited
since

1.7.0

Arguments

$fieldName

stringThe field element name.

Response

stringThe name to be used for the field input tag.

getRenderer

Get the renderer

getRenderer(string $layoutId = 'default') : \Joomla\CMS\Layout\FileLayout
inherited
since

3.5

Arguments

$layoutId

stringId to load

Response

\Joomla\CMS\Layout\FileLayout

getTitle

Method to get the field title.

getTitle() : string
inherited
since

1.7.0

Response

stringThe field title.

isDebugEnabled

Is debug enabled for this field

isDebugEnabled() : boolean
inherited
since

3.5

Response

boolean

render

Render a layout of this field

render(string $layoutId, array $data = array()) : string
inherited
since

3.5

Arguments

$layoutId

stringLayout identifier

$data

arrayOptional data for the layout

Response

string

renderField

Method to get a control group with label and input.

renderField(array $options = array()) : string
inherited
since

3.2

Arguments

$options

arrayOptions to be passed into the rendering of the field

Response

stringA string containing the html for the control group

setForm

Method to attach a JForm object to the field.

setForm(\Joomla\CMS\Form\Form $form) : \Joomla\CMS\Form\FormField
inherited
since

1.7.0

Arguments

$form

\Joomla\CMS\Form\FormThe JForm object to attach to the form field.

Response

\Joomla\CMS\Form\FormFieldThe form field object so that the method can be used in a chain.

setup

Method to attach a JForm object to the field.

setup(\SimpleXMLElement $element, mixed $value, string $group = null) : boolean
inherited
since

1.7.0

Arguments

$element

\SimpleXMLElementThe SimpleXMLElement object representing the <field> tag for the form field object.

$value

mixedThe form field value to validate.

$group

stringThe field name group control value. This acts as as an array container for the field. For example if the field has name="foo" and the group value is set to "bar" then the full field name would end up being "bar[foo]".

Response

booleanTrue on success.

setValue

Simple method to set the value

setValue(mixed $value) : void
inherited
since

3.2

Arguments

$value

mixedValue to set

Properties

type

The form field type.

inherited
since

1.7.0

Type(s)

string

authorField

The authorField.

since

3.2

Type(s)

string

asset

The asset.

since

3.2

Type(s)

string

width

Modal width.

since

3.4.5

Type(s)

integer

height

Modal height.

since

3.4.5

Type(s)

integer

preview

The authorField.

since

3.2

Type(s)

string

directory

The preview.

since

3.2

Type(s)

string

previewWidth

The previewWidth.

since

3.2

Type(s)

integer

previewHeight

The previewHeight.

since

3.2

Type(s)

integer

layout

Name of the layout being used to render the field

inherited
since

3.5

Type(s)

string

description

The description text for the form field. Usually used in tooltips.

inherited
since

1.7.0

Type(s)

string

hint

The hint text for the form field used to display hint inside the field.

inherited
since

3.2

Type(s)

string

autocomplete

The autocomplete state for the form field. If 'off' element will not be automatically completed by browser.

inherited
since

3.2

Type(s)

mixed

spellcheck

The spellcheck state for the form field.

inherited
since

3.2

Type(s)

boolean

autofocus

The autofocus request for the form field. If true element will be automatically focused on document load.

inherited
since

3.2

Type(s)

boolean

element

The SimpleXMLElement object of the <field> XML element that describes the form field.

inherited
since

1.7.0

Type(s)

\SimpleXMLElement

form

The Form object of the form attached to the form field.

inherited
since

1.7.0

Type(s)

\Joomla\CMS\Form\Form

formControl

The form control prefix for field names from the JForm object attached to the form field.

inherited
since

1.7.0

Type(s)

string

hidden

The hidden state for the form field.

inherited
since

1.7.0

Type(s)

boolean

translateLabel

True to translate the field label string.

inherited
since

1.7.0

Type(s)

boolean

translateDescription

True to translate the field description string.

inherited
since

1.7.0

Type(s)

boolean

translateHint

True to translate the field hint string.

inherited
since

3.2

Type(s)

boolean

id

The document id for the form field.

inherited
since

1.7.0

Type(s)

string

input

The input for the form field.

inherited
since

1.7.0

Type(s)

string

label

The label for the form field.

inherited
since

1.7.0

Type(s)

string

multiple

The multiple state for the form field. If true then multiple values are allowed for the field. Most often used for list field types.

inherited
since

1.7.0

Type(s)

boolean

repeat

Allows extensions to create repeat elements

inherited
since

3.2

Type(s)

mixed

pattern

The pattern (Reg Ex) of value of the form field.

inherited
since

1.7.0

Type(s)

string

validationtext

The validation text of invalid value of the form field.

inherited
since

4.0

Type(s)

string

name

The name of the form field.

inherited
since

1.7.0

Type(s)

string

fieldname

The name of the field.

inherited
since

1.7.0

Type(s)

string

group

The group of the field.

inherited
since

1.7.0

Type(s)

string

required

The required state for the form field. If true then there must be a value for the field to be considered valid.

inherited
since

1.7.0

Type(s)

boolean

disabled

The disabled state for the form field. If true then the field will be disabled and user can't interact with the field.

inherited
since

3.2

Type(s)

boolean

readonly

The readonly state for the form field. If true then the field will be readonly.

inherited
since

3.2

Type(s)

boolean

validate

The validation method for the form field. This value will determine which method is used to validate the value for a field.

inherited
since

1.7.0

Type(s)

string

value

The value of the form field.

inherited
since

1.7.0

Type(s)

mixed

default

The default value of the form field.

inherited
since

1.7.0

Type(s)

mixed

size

The size of the form field.

inherited
since

3.2

Type(s)

integer

class

The class of the form field

inherited
since

3.2

Type(s)

mixed

labelclass

The label's CSS class of the form field

inherited
since

1.7.0

Type(s)

mixed

onchange

The javascript onchange of the form field.

inherited
since

3.2

Type(s)

string

onclick

The javascript onclick of the form field.

inherited
since

3.2

Type(s)

string

showon

The conditions to show/hide the field.

inherited
since

3.7.0

Type(s)

string

count

The count value for generated name field

inherited static
since

1.7.0

Type(s)

integer

generated_fieldname

The string used for generated fields names

inherited static
since

1.7.0

Type(s)

string

renderLayout

Layout to render the form field

inherited

Type(s)

string

renderLabelLayout

Layout to render the label

inherited

Type(s)

string