Overview

Namespaces

  • None
  • Xmf
    • Database
    • Module
      • Helper
    • Template
  • Xoops
    • Auth
    • Core
      • Cache
      • Database
        • Logging
        • Schema
      • Exception
      • Handler
        • Scheme
      • Kernel
        • Dtype
        • Handlers
        • Model
      • Lists
      • Locale
        • Punic
      • Service
        • Contract
      • Session
      • Text
        • Sanitizer
          • Extensions
      • Theme
        • Plugins
    • Form
    • Html
    • Locale
    • Module
      • Helper
      • Plugin

Classes

  • BlockForm
  • Button
  • ButtonTray
  • Captcha
  • Checkbox
  • ColorPicker
  • DateSelect
  • DateTime
  • DhtmlTextArea
  • Editor
  • Element
  • ElementFactory
  • ElementTray
  • File
  • Form
  • GroupCheckbox
  • GroupFormCheckbox
  • GroupPermissionForm
  • Hidden
  • Label
  • Mail
  • OptionElement
  • Password
  • Radio
  • RadioYesNo
  • Raw
  • Select
  • SelectCountry
  • SelectEditor
  • SelectGroup
  • SelectLanguage
  • SelectLocale
  • SelectMatchOption
  • SelectTheme
  • SelectTimeZone
  • SelectUser
  • SimpleForm
  • Tab
  • TableForm
  • TabTray
  • Text
  • TextArea
  • ThemeForm
  • Token
  • Url

Interfaces

  • ContainerInterface
  • Overview
  • Namespace
  • Class
  • Tree

Class Element

Element - Abstract base class for form elements

ArrayObject implements IteratorAggregate, Traversable, ArrayAccess, Serializable, Countable
Extended by Xoops\Html\Attributes implements Xoops\Core\AttributeInterface
Extended by Xoops\Form\Element

Direct known subclasses

Xoops\Form\Button, Xoops\Form\ButtonTray, Xoops\Form\Raw, Xoops\Form\Text, Xoops\Form\TextArea, XoopsFormElement, Xoops\Form\Captcha, Xoops\Form\ElementTray, Xoops\Form\File, Xoops\Form\GroupFormCheckbox, Xoops\Form\Hidden, Xoops\Form\Label, Xoops\Form\OptionElement, Xoops\Form\Password

Indirect known subclasses

AwesomeButton, FormDhtmlTextArea, Xoops\Form\GroupCheckbox, Xoops\Form\Mail, Xoops\Form\Radio, Xoops\Form\RadioYesNo, Xoops\Form\Select, Xoops\Form\SelectCountry, Xoops\Form\SelectEditor, Xoops\Form\SelectGroup, Xoops\Form\SelectLanguage, Xoops\Form\SelectLocale, FormTextArea, Xoops\Form\SelectMatchOption, Xoops\Form\SelectTheme, Xoops\Form\SelectTimeZone, Xoops\Form\SelectUser, Xoops\Form\Tab, Xoops\Form\TabTray, Xoops\Form\Token, Xoops\Form\Url, XoopsEditor, XoopsFormButton, PublisherFormDateTime, XoopsFormButtonTray, XoopsFormCaptcha, XoopsFormCheckBox, XoopsFormColorPicker, XoopsFormDateTime, XoopsFormDhtmlTextArea, XoopsFormEditor, XoopsFormElementTray, XoopsFormFile, XoopsFormHidden, Xoops\Form\Checkbox, XoopsFormHiddenToken, XoopsFormLabel, XoopsFormPassword, XoopsFormRadio, XoopsFormRadioYN, XoopsFormSelect, XoopsFormSelectCheckGroup, XoopsFormSelectCountry, XoopsFormSelectEditor, XoopsFormSelectGroup, Xoops\Form\ColorPicker, XoopsFormSelectLang, XoopsFormSelectMatchOption, XoopsFormSelectTheme, XoopsFormSelectTimezone, XoopsFormSelectUser, XoopsFormText, XoopsFormTextArea, XoopsFormTextDateSelect, XoopsFormTinymce, XoopsFormTinymce4, Xoops\Form\DateSelect, Xoops\Form\DateTime, Xoops\Form\DhtmlTextArea, Xoops\Form\Editor
Abstract
Namespace: Xoops\Form
Package: Xoops\Form
Category: Xoops\Form\Element
Copyright: 2012-2015 XOOPS Project (http://xoops.org)
License: GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
Author: trabis lusopoemas@gmail.com
Link: http://xoops.org
Located at oops_lib/Xoops/Form/Element.php
Methods summary
public
# __construct( array $attributes = array() )

__construct

__construct

Parameters

$attributes

array of attribute name => value pairs Control attributes: ElementFactory::FORM_KEY optional form or tray to hold this element

Overrides

Xoops\Html\Attributes::__construct()
abstract public string
# render( )

render - Generates output for the element.

render - Generates output for the element.

This method is abstract and must be overwritten by the child classes.

Returns

string
public string
# renderAttributeString( )

render attributes as a string to include in HTML output

render attributes as a string to include in HTML output

Returns

string

Overrides

Xoops\Html\Attributes::renderAttributeString()
public mixed
# getValue( boolean $encode = false )

getValue - Get an array of pre-selected values

getValue - Get an array of pre-selected values

Parameters

$encode
True to encode special characters

Returns

mixed
public
# setValue( mixed $value )

setValue - Set pre-selected values

setValue - Set pre-selected values

Parameters

$value
value to assign to this element
public
# setName( string $name )

setName - set the "name" attribute for the element

setName - set the "name" attribute for the element

Parameters

$name
"name" attribute for the element
public string
# getName( )

getName - get the "name" attribute for the element

getName - get the "name" attribute for the element

Returns

string
public
# setAccessKey( string $key )

setAccessKey - set the access key attribute for the element

setAccessKey - set the access key attribute for the element

Parameters

$key
"accesskey" attribute for the element
public string
# getAccessKey( )

getAccessKey - get the access key attribute for the element

getAccessKey - get the access key attribute for the element

Returns

string
"accesskey" attribute value
public string
# getAccessString( string $str )

getAccessString - If the access key is found in the specified string, underline it

getAccessString - If the access key is found in the specified string, underline it

Parameters

$str
string to add access key highlight to

Returns

string
Enhanced string with the 1st occurrence of "accesskey underlined
public
# setClass( string $class )

setClass - set the "class" attribute for the element

setClass - set the "class" attribute for the element

Parameters

$class
class attribute for the element
public string
# getClass( )

getClass - get the "class" attribute for the element

getClass - get the "class" attribute for the element

Returns

string
"class" attribute value
public
# setPattern( string $pattern, string $patternDescription = '' )

setPattern - set the "pattern" attribute for the element

setPattern - set the "pattern" attribute for the element

Parameters

$pattern
pattern attribute for the element
$patternDescription
pattern description
public string
# getPattern( )

getPattern - get the "pattern" attribute for the element

getPattern - get the "pattern" attribute for the element

Returns

string
"pattern"
public string
# getPatternDescription( )

getPatternDescription - get the "pattern_description"

getPatternDescription - get the "pattern_description"

Returns

string
"pattern_description"
public
# setDatalist( string[]|string $datalist )

setDatalist - set the datalist attribute for the element

setDatalist - set the datalist attribute for the element

Parameters

$datalist
datalist attribute for the element
public string
# renderDatalist( )

renderDatalist - get the datalist attribute for the element

renderDatalist - get the datalist attribute for the element

Returns

string
"datalist" attribute value
public boolean
# isDatalist( )

isDatalist - is there a datalist for the element?

isDatalist - is there a datalist for the element?

Returns

boolean
true if element has a non-empty datalist
public
# setCaption( string $caption )

setCaption - set the caption for the element

setCaption - set the caption for the element

Parameters

$caption
caption for element
public string
# getCaption( )

getCaption - get the caption for the element

getCaption - get the caption for the element

Returns

string
public
# setTitle( string $title )

setTitle - set the title for the element

setTitle - set the title for the element

Parameters

$title
title for element
public string
# getTitle( )

getTitle - get the title for the element

getTitle - get the title for the element

Returns

string
public
# setDescription( string $description )

setDescription - set the element's description

setDescription - set the element's description

Parameters

$description
description
public string
# getDescription( boolean $encode = false )

getDescription - get the element's description

getDescription - get the element's description

Parameters

$encode
True to encode special characters

Returns

string
public
# setHidden( )

setHidden - flag the element as "hidden"

setHidden - flag the element as "hidden"

public boolean
# isHidden( )

isHidden - is this a hidden element?

isHidden - is this a hidden element?

Returns

boolean
true if hidden
public
# setRequired( boolean $bool = true )

setRequired - set entry required

setRequired - set entry required

Parameters

$bool
true to set required entry for this element
public boolean
# isRequired( )

isRequired - is entry required for this element?

isRequired - is entry required for this element?

Returns

boolean
true if entry is required
public string[]
# setExtra( string $extra, boolean $replace = false )

setExtra - Add extra attributes to the element.

setExtra - Add extra attributes to the element.

This string will be inserted verbatim and unvalidated in the element's tag. Know what you are doing!

Deprecated

please use attributes for event scripting

Parameters

$extra
extra raw text to insert into form
$replace

If true, passed string will replace current content, otherwise it will be appended to it

Returns

string[]
New content of the extra string
public string
# getExtra( boolean $encode = false )

getExtra - Get the extra attributes for the element

getExtra - Get the extra attributes for the element

Parameters

$encode
True to encode special characters

Returns

string

See

setExtra() this is going to disappear
public
# addCustomValidationCode( string $code, boolean $replace = false )

addCustomValidationCode - Add custom validation javascript

addCustomValidationCode - Add custom validation javascript

This string will be inserted verbatim and unvalidated in the page. Know what you are doing!

Parameters

$code
javascript code to insert into form
$replace

If true, passed string will replace current code, otherwise it will be appended to it

public string|false
# renderValidationJS( )

renderValidationJS - Render custom javascript validation code

renderValidationJS - Render custom javascript validation code

Returns

string|false
public integer|false
# hasClassLike( string $pattern )

Test if a class that starts with the pattern string is set

Test if a class that starts with the pattern string is set

Parameters

$pattern
'starts with' to match

Returns

integer|false
false if no match, or index of matching class
public
# themeDecorateElement( )

themeDecorateElement - add theme decoration to element

themeDecorateElement - add theme decoration to element

public
# setWithDefaults( string $name, mixed $value, mixed $default = null, array $enum = null )

Convenience method to assist with setting attributes when using BC Element syntax

Convenience method to assist with setting attributes when using BC Element syntax

Set attribute $name to $value, replacing $value with $default if $value is empty, or if the value is not one of the values specified in the (optional) $enum array

Parameters

$name
attribute name
$value
attribute value
$default
default value
$enum
optional list of valid values
public
# setIfNotEmpty( string $name, mixed $value )

Convenience method to assist with setting attributes when using BC Element syntax

Convenience method to assist with setting attributes when using BC Element syntax

Set attribute $name to $value, replacing $value with $default if $value is empty, or if the value is not one of the values specified in the (optional) $enum array

Parameters

$name
attribute name
$value
attribute value
public
# setIfNotSet( string $name, mixed $value )

Convenience method to assist with setting attributes

Convenience method to assist with setting attributes

Set attribute $name to $value, replacing $value with $default if $value is empty, or if the value is not one of the values specified in the (optional) $enum array

Parameters

$name
attribute name
$value
attribute value
Methods inherited from Xoops\Html\Attributes
add(), clear(), doRender(), get(), getAll(), getAllLike(), getNames(), has(), remove(), set(), setAll(), setArrayItem(), setMerge(), suppressRender()
Methods inherited from ArrayObject
append(), asort(), count(), exchangeArray(), getArrayCopy(), getFlags(), getIterator(), getIteratorClass(), ksort(), natcasesort(), natsort(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), serialize(), setFlags(), setIteratorClass(), uasort(), uksort(), unserialize()
Constants inherited from ArrayObject
ARRAY_AS_PROPS, STD_PROP_LIST
Properties summary
protected string[] $suppressList

list of attributes to NOT render

list of attributes to NOT render

# ['caption', 'datalist', 'description', 'option']
public array $customValidationCode

Javascript performing additional validation of this element data

Javascript performing additional validation of this element data

This property contains a list of Javascript snippets that will be sent to \Xoops\Form\Form::renderValidationJS(). NB: All elements are added to the output one after the other, so don't forget to add a ";" after each to ensure no Javascript syntax error is generated.

# array()
protected array $extra

extra attributes to go in the tag

extra attributes to go in the tag

# array()
Properties inherited from Xoops\Html\Attributes
$suppressRenderAttributes
API documentation generated by ApiGen