Sledgehammer Framework

Form extends Element
in package
implements Import, ArrayAccess

Generate and import a Form.

$form = new Form([new Input(['name' => 'field')]); $data = $form->import()

Interfaces, Classes, Traits and Enums

Import
Iterface for importing request data.
ArrayAccess

Table of Contents

$actions  : array<string|int, Component>
$fields  : array<string|int, Import>
$fieldset  : bool
Wrap the field in a <fieldset>.
$legend  : string
The <legend>.
$tag  : string
Element type: "div", "span", etc.
$attributes  : array<string|int, mixed>
Attributes for the html element.
$state  : string
__call()  : mixed
Report that the $method doesn't exist.
__callStatic()  : mixed
Report that the $method doesn't exist.
__construct()  : mixed
Constructor.
__get()  : mixed
Report that $property doesn't exist.
__set()  : mixed
Report that $property doesn't exist and set the property to the given $value.
__toString()  : string
The object is used as an string.
addClass()  : this|Element
Adds the specified class(es) to the element.
attr()  : this|Element|mixed
Get the value of an attribute or set one or more attributes.
booleanAttribute()  : bool
Check if a boolean attribute such as 'checked' or 'selected' is enabled.
getAttribute()  : mixed
Returns the value of the named attribute on the element.
getValue()  : mixed
Get the current value.
hasAttribute()  : bool
Returns a boolean value indicating whether the specified element has the specified attribute or not.
hasClass()  : bool
Determine whether the element is assigned the given class.
import()  : mixed
Import the new value based on the request and return the current value;.
isSent()  : mixed
offsetExists()  : mixed
offsetGet()  : mixed
offsetSet()  : mixed
offsetUnset()  : mixed
removeAttribute()  : mixed
Removes an attribute from the element.
removeClass()  : this|Element
Remove a single class, multiple classes, or all classes from the element.
render()  : mixed
Render the element(s).
renderContents()  : mixed
setAttribute()  : mixed
Adds a new attribute or changes the value of an existing attribute on the element.
setValue()  : mixed
Set the (default) value.
toggleClass()  : this|Element
Add or remove one or more classes from each element in the set of matched elements, depending on either the class’s presence or the value of the switch argument.

Properties

$actions

public array<string|int, Component> $actions = []

$fieldset

Wrap the field in a <fieldset>.

public bool $fieldset = true

$legend

The <legend>.

public string $legend

$tag

Element type: "div", "span", etc.

public string $tag = 'form'

$attributes

Attributes for the html element.

protected array<string|int, mixed> $attributes = ['method' => 'post']

$state

protected string $state = 'UNKNOWN'

'UNKNOWN', 'NOT_SENT', 'SENT'

Methods

__call()

Report that the $method doesn't exist.

public __call(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed —

__callStatic()

Report that the $method doesn't exist.

public static __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>
Return values
mixed —

__construct()

Constructor.

public __construct(mixed $options) : mixed
Parameters
$options : mixed

Array containing properties and attribute values

Return values
mixed —

__get()

Report that $property doesn't exist.

public __get(string $property) : mixed
Parameters
$property : string
Return values
mixed —

__set()

Report that $property doesn't exist and set the property to the given $value.

public __set(string $property, mixed $value) : mixed
Parameters
$property : string
$value : mixed
Return values
mixed —

__toString()

The object is used as an string.

public __toString() : string
Return values
string —

addClass()

Adds the specified class(es) to the element.

public addClass(string|array<string|int, mixed> $class) : this|Element
Parameters
$class : string|array<string|int, mixed>

One or more space-separated classes to be added to the class attribute.

Return values
this|Element —

attr()

Get the value of an attribute or set one or more attributes.

public attr(string $attribute[, mixed $value = null ]) : this|Element|mixed
Parameters
$attribute : string
$value : mixed = null

optional

Return values
this|Element|mixed —

booleanAttribute()

Check if a boolean attribute such as 'checked' or 'selected' is enabled.

public booleanAttribute(string $name) : bool
Parameters
$name : string
Return values
bool —

getAttribute()

Returns the value of the named attribute on the element.

public getAttribute(string $name) : mixed

If the named attribute does not exist it will return null.

Parameters
$name : string
Return values
mixed —

getValue()

Get the current value.

public getValue() : mixed
Return values
mixed —

hasAttribute()

Returns a boolean value indicating whether the specified element has the specified attribute or not.

public hasAttribute(string $name) : bool
Parameters
$name : string
Return values
bool —

hasClass()

Determine whether the element is assigned the given class.

public hasClass(string $class) : bool
Parameters
$class : string
Return values
bool —

import()

Import the new value based on the request and return the current value;.

public import([mixed &$errors = null ][, mixed $request = null ]) : mixed
Parameters
$errors : mixed = null
$request : mixed = null

Allow overwriting the default $_REQUEST

Return values
mixed —

The (updated) value

isSent()

public isSent() : mixed
Return values
mixed —

offsetExists()

public offsetExists(mixed $offset) : mixed
Parameters
$offset : mixed
Return values
mixed —

offsetGet()

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed
Return values
mixed —

offsetSet()

public offsetSet(mixed $offset, mixed $value) : mixed
Parameters
$offset : mixed
$value : mixed
Return values
mixed —

offsetUnset()

public offsetUnset(mixed $offset) : mixed
Parameters
$offset : mixed
Return values
mixed —

removeAttribute()

Removes an attribute from the element.

public removeAttribute(string $name) : mixed
Parameters
$name : string
Return values
mixed —

removeClass()

Remove a single class, multiple classes, or all classes from the element.

public removeClass(string|array<string|int, mixed> $class) : this|Element
Parameters
$class : string|array<string|int, mixed>
Return values
this|Element —

render()

Render the element(s).

public render() : mixed
Return values
mixed —

renderContents()

public renderContents() : mixed
Return values
mixed —

setAttribute()

Adds a new attribute or changes the value of an existing attribute on the element.

public setAttribute(string $name, mixed $value) : mixed
Parameters
$name : string

The name of the attribute.

$value : mixed

The desired new value of the attribute

Return values
mixed —

setValue()

Set the (default) value.

public setValue(mixed $values) : mixed
Parameters
$values : mixed
Return values
mixed —

toggleClass()

Add or remove one or more classes from each element in the set of matched elements, depending on either the class’s presence or the value of the switch argument.

public toggleClass(string $class) : this|Element
Parameters
$class : string
Return values
this|Element —

Search results