[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

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

Class Element The basic building block of a form

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

Defines 8 functions

  __construct()
  getType()
  attr()
  rmattr()
  attrs()
  addClass()
  id()
  val()

Functions
Functions that are not part of a class:

__construct($type, $attributes = array()   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

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

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

param: string $name
return: $this

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

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

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

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

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

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

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

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

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

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

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