[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Form/ -> InputElement.php (summary)

(no description)

File Size: 170 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

InputElement:: (9 methods):
  __construct()
  getLabel()
  useInput()
  id()
  addClass()
  getInputName()
  prefillInput()
  mainElementHTML()
  toHTML()


Class: InputElement  - X-Ref

Class InputElement

Base class for all input elements. Uses a wrapping label when label
text is given.

__construct($type, $name, $label = '')   X-Ref

param: string $type The type of this element
param: string $name The name of this form element
param: string $label The label text for this element (will be autoescaped)

getLabel()   X-Ref
Returns the label element if there's one set

return: LabelElement|null

useInput($useinput)   X-Ref
Should the user sent input be used to initialize the input field

The default is true. Any set values will be overwritten by the INPUT
provided values.

return: $this
param: bool $useinput

id($id = null)   X-Ref
Get or set the element's ID

return: string|$this
param: null|string $id

addClass($class)   X-Ref
Adds a class to the class attribute

This is the preferred method of setting the element's class

return: $this
param: string $class the new class to add

getInputName()   X-Ref
Figures out how to access the value for this field from INPUT data

The element's name could have been given as a simple string ('foo')
or in array notation ('foo[bar]').

Note: this function only handles one level of arrays. If your data
is nested deeper, you should call useInput(false) and set the
correct value yourself

return: array name and array key (null if not an array)

prefillInput()   X-Ref
Handles the useInput flag and set the value attribute accordingly


mainElementHTML()   X-Ref
The HTML representation of this element

return: string

toHTML()   X-Ref
The HTML representation of this element wrapped in a label

return: string