PHP Класс Habari\FormContainer

Наследование: extends FormControl
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$controls

Открытые методы

Метод Описание
__get ( string $name ) : FormControl Magic property getter, returns the specified control
__isset ( string $name ) : boolean Magic property isset, returns if the specified control exists
append ( FormControl $control ) : FormControl | FormContainer Append a control to the end of this container
clear ( ) Reset the contained control values to their initial values
control_id ( ) : string Obtain a unique identifier for this control that is the same every time the form is generated
do_success ( FormUI $form ) : boolean | string Calls the success callback for the form, and optionally saves the form values to the options table.
each ( Callable $fn ) Apply a function to every control in this container, and any sub-containers
errors_get ( string $format, string $wrap = '%s' ) : string Return any validation errors on any controls in this container using the supplied format $this->validate must be called first!
errors_out ( $format, $wrap = '%s' ) Output any validation errors on any controls in this container using the supplied format $this->validate must be called first!
get ( Theme $theme ) : string Produce HTML output for all this fieldset and all contained controls
get_contents ( Theme $theme ) : string Get the control contents of this container
get_control ( string $name ) : FormControl | null Get a control from this container by name.
get_controls ( ) : array Returns an associative array of controls
get_value_out ( array $tag_fields ) : boolean | string Return the property value that is associated with the first present property from an array list This version only searches the list of the class' $properties array, because __get() on this objcet returns named FormControls instances
get_values ( ) : array Returns an associative array of the controls' values
insert ( FormControl $before, FormControl $control ) : FormControl
load ( ) Load this control and its children's initial data from the initialized storage location
move ( FormControl $source, FormControl $target, integer $offset ) Moves a control to target's position to which we add $int if specified That integer is useful to move before or move after the target
move_after ( FormControl $control, FormControl $target ) Moves a control after the target control
move_before ( FormControl $control, FormControl $target ) Moves a control before the target control
move_into ( FormControl $control, FormContainer $target ) Move a control into the container
pre_out ( ) : string Return the HTML/script required for all contained controls. Do it only once.
process ( ) Obtain the value of this control as supplied by the incoming $_POST values
remove ( FormControl $target ) Removes a target control from this group (can be the form or a fieldset)
replace ( FormControl $target, FormControl $control ) Replaces a target control by the supplied control
save ( ) Store each contained control's value under the control's specified key.
set_control_id ( string $control_id ) : FormControl Set the unique identifier for this control.
set_wrap_each ( string $wrap = '%s' ) : FormContainer Set a sprintf-style string that will wrap each control within this container with markup Use to create, for example,
%s
for each control in the container
validate ( ) : array Runs any attached validation functions to check validation of each control contained in this fieldset.

Описание методов

__get() публичный Метод

Magic property getter, returns the specified control
public __get ( string $name ) : FormControl
$name string The name of the control
Результат FormControl The control object requested

__isset() публичный Метод

Magic property isset, returns if the specified control exists
public __isset ( string $name ) : boolean
$name string The name of the control
Результат boolean If the control object is set

append() публичный Метод

Append a control to the end of this container
public append ( FormControl $control ) : FormControl | FormContainer
$control FormControl A control to append to the end of this container
Результат FormControl | FormContainer The provided FormControl object, fluid

clear() публичный Метод

Reset the contained control values to their initial values
public clear ( )

control_id() публичный Метод

Obtain a unique identifier for this control that is the same every time the form is generated
public control_id ( ) : string
Результат string An md5 hash built using the controls contained within this container

do_success() публичный Метод

Calls the success callback for the form, and optionally saves the form values to the options table.
public do_success ( FormUI $form ) : boolean | string
$form FormUI The form for which success is being processed
Результат boolean | string A string to replace the rendering of the form with, or false

each() публичный Метод

Apply a function to every control in this container, and any sub-containers
public each ( Callable $fn )
$fn Callable A function with the signature (FormControl $control)

errors_get() публичный Метод

Return any validation errors on any controls in this container using the supplied format $this->validate must be called first!
public errors_get ( string $format, string $wrap = '%s' ) : string
$format string A sprintf()-style format string to format the validation error
$wrap string A sprintf()-style format string to wrap the returned error, only if at least one error exists
Результат string The errors in the supplied format

errors_out() публичный Метод

Output any validation errors on any controls in this container using the supplied format $this->validate must be called first!
public errors_out ( $format, $wrap = '%s' )

get() публичный Метод

Produce HTML output for all this fieldset and all contained controls
public get ( Theme $theme ) : string
$theme Theme The theme used to render the controls
Результат string HTML that will render this control in the form

get_contents() публичный Метод

Get the control contents of this container
public get_contents ( Theme $theme ) : string
$theme Theme The theme used to render the controls
Результат string The requested HTML output

get_control() публичный Метод

Get a control from this container by name.
public get_control ( string $name ) : FormControl | null
$name string The name of the control
Результат FormControl | null The control object requested, or null if not found

get_controls() публичный Метод

Returns an associative array of controls
public get_controls ( ) : array
Результат array An array of FormControls

get_value_out() публичный Метод

Return the property value that is associated with the first present property from an array list This version only searches the list of the class' $properties array, because __get() on this objcet returns named FormControls instances
public get_value_out ( array $tag_fields ) : boolean | string
$tag_fields array A list of potential fields to try
Результат boolean | string False if no value found, string of the property value found

get_values() публичный Метод

Returns an associative array of the controls' values
public get_values ( ) : array
Результат array Associative array where key is control's name and value is the control's value

insert() публичный Метод

public insert ( FormControl $before, FormControl $control ) : FormControl
$before FormControl The control to insert the control in front of
$control FormControl The control to insert
Результат FormControl $control via Fluent interface

load() публичный Метод

Load this control and its children's initial data from the initialized storage location
public load ( )

move() публичный Метод

Moves a control to target's position to which we add $int if specified That integer is useful to move before or move after the target
public move ( FormControl $source, FormControl $target, integer $offset )
$source FormControl FormControl object to move
$target FormControl FormControl object acting as destination
$offset integer Integer added to $target's position (index)

move_after() публичный Метод

Moves a control after the target control
public move_after ( FormControl $control, FormControl $target )
$control FormControl FormControl object to move
$target FormControl FormControl object acting as destination

move_before() публичный Метод

Moves a control before the target control
public move_before ( FormControl $control, FormControl $target )
$control FormControl FormControl object to move
$target FormControl FormControl object acting as destination

move_into() публичный Метод

Move a control into the container
public move_into ( FormControl $control, FormContainer $target )
$control FormControl FormControl object to move
$target FormContainer FormContainer object acting as destination

pre_out() публичный Метод

Return the HTML/script required for all contained controls. Do it only once.
public pre_out ( ) : string
Результат string The HTML/javascript required for all contained controls.

process() публичный Метод

Obtain the value of this control as supplied by the incoming $_POST values
public process ( )

remove() публичный Метод

Removes a target control from this group (can be the form or a fieldset)
public remove ( FormControl $target )
$target FormControl FormControl to remove

replace() публичный Метод

Replaces a target control by the supplied control
public replace ( FormControl $target, FormControl $control )
$target FormControl FormControl object to replace
$control FormControl FormControl object to replace $target with

save() публичный Метод

Store each contained control's value under the control's specified key.
public save ( )

set_control_id() публичный Метод

This DOES NOT set the id attribute of the output HTML for this control!
public set_control_id ( string $control_id ) : FormControl
$control_id string A unique value identifying this control internally
Результат FormControl $this

set_wrap_each() публичный Метод

Set a sprintf-style string that will wrap each control within this container with markup Use to create, for example,
%s
for each control in the container
public set_wrap_each ( string $wrap = '%s' ) : FormContainer
$wrap string The sprintf-style formatting string
Результат FormContainer $this

validate() публичный Метод

Runs any attached validation functions to check validation of each control contained in this fieldset.
public validate ( ) : array
Результат array An array of string validation error descriptions or an empty array if no errors were found.

Описание свойств

$controls публичное свойство

public $controls