[ Index ]

PHP Cross Reference of DokuWiki




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

Class Element The basic building block of a form

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

Defines 8 functions


Functions that are not part of a class:

__construct($type, $attributes = [])   X-Ref

param: string $type The type of this element
param: array $attributes

getType()   X-Ref
Type of this element

return: string

attr($name, $value = null)   X-Ref
Gets or sets an attribute

When no $value is given, the current content of the attribute is returned.
An empty string is returned for unset attributes.

When a $value is given, the content is set to that value and the Element
itself is returned for easy chaining

return: string|$this
param: string $name Name of the attribute to access
param: null|string $value New value to set

rmattr($name)   X-Ref
Removes the given attribute if it exists

return: $this
param: string $name

attrs($attributes = null)   X-Ref
Gets or adds a all given attributes at once

return: array|$this
param: array|null $attributes

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

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

This is the preferred way of setting the element's ID

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

val($value = null)   X-Ref
Get or set the element's value

This is the preferred way of setting the element's value

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