PHP Класс Formo_Core_Formo

Показать файл Открыть проект

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

Метод Описание
__construct ( array $array = NULL ) : Formo Set up new field
__get ( mixed $key ) : mixed Return a field Retuns NULL if the field doesn't exist
__invoke ( ) : string Convert just the input to html
__isset ( mixed $key ) : boolean Determine whether a field exists
__set ( mixed $key, mixed $value ) : void Add a field to another field. Only works with Formo objects
__toString ( ) : string Render the Formo object
add ( mixed $alias, mixed $driver = NULL, mixed $value = NULL, array $opts = NULL ) : void Add a field or subform to a field or form
add_class ( mixed $class ) : Formo Add a class tag to the field
add_rule ( mixed $rule, array $params = NULL ) : Formo Add a single rule
add_rule_fields ( array $rule, array $fields ) : void Add a single rule accross a group of fields
add_rules ( array $array ) : void Add multiple rules at a time
add_rules_fields ( array $array ) : Formo Add rules for multiple fields
alias ( ) : string Helper method to return the field's alias
as_array ( mixed $value = NULL, boolean $recursive = FALSE ) : array Return the field or form as an array
attr ( mixed $get, mixed $set = NULL ) : Formo Set an html attribute or attributes
attr_fields ( array $array ) : void Set attributes for a set of fields
blueprint_deleted ( $field = NULL )
blueprint_dynamic ( $field = NULL )
callback ( mixed $type, array $callbacks = NULL ) : Formo Setup callback or callbacks
close ( ) : string Return the field's closing tag
copy_blueprint ( array $vals = [] ) : Formo Create a copy from form or group object
driver ( mixed $func, array $args = NULL ) : mixed Run a method through a field's driver
error ( mixed $message = NULL, array $params = [] ) : mixed Get or set a field error
errors ( array &$array = NULL ) : array Get field errors
factory ( array $array = NULL ) : Formo Simple factory method
find ( mixed $alias, boolean $not_recursive = FALSE ) : mixed Find a field by its alias Returns NULL if field can't be found
flatten ( array &$array = NULL ) : Formo Flatten fields in a form
form ( array $array = NULL ) : Formo Helper method to return a form field
ftype ( array $array = [] )
get ( mixed $var, mixed $default = NULL ) : mixed Get a field attribute You can use Arr::path dot syntax to retrieve a value
html ( mixed $str = NULL ) : void Get or set HTML
input ( ) : string Convert just the input to html
label ( ) : void Return a field's label
load ( array $values = NULL, array $files = NULL ) : Formo Load an array of alias => value pairs into a form
merge ( mixed $property, array $array = NULL ) : Formo Merge a field with an array value with a new array
merge_fields ( array $array ) : Formo Merge properties for multiple fields
name ( ) : string Return a field's HTML 'name' tag value
open ( ) : string Return a field's HTML opening tag
order ( mixed $field, mixed $new_order = NULL, mixed $relative_field = NULL ) : Formo Reorder a field or multiple fields
orm ( mixed $method, array $vals = NULL ) : Formo (Deprecated) Run a method through the ORM driver
pad_blueprint ( $count_or_vals = 1 ) : Formo Pad group with number of blueprints
parent ( mixed $group_or_form = FALSE ) : mixed Find a field's parent If TRUE passed, find the field's parent (return that field if it is the parent)
remove ( mixed $alias ) : Formo Remove a field or fields from a form
remove_class ( mixed $class ) : Formo Remove a class or classes
remove_rule ( mixed $rule ) : Formo Remove a rule or rules from a field.
remove_rules ( array $array ) : void Remove multiple rules at a time
remove_rules_fields ( mixed $array ) : void Remove rules for multiple fields
render ( $template = NULL ) : string Render a field from its view file
render_opts ( ) : string Render options (used for select, checkboxes, radios)
reset ( ) : Formo Reset field values to their original values
sent ( array $input_array = NULL ) : boolean Determine whether a form or field has been sent
set ( mixed $var, mixed $val = NULL ) : void Set a value for a field's attribute You can use Arr::set_path's dot-syntax to set an attribute
set_fields ( array $array, boolean $not_recursive = TRUE ) : void Set variables for a set of fields
set_var_fields ( mixed $var, array $array, boolean $not_recursive = TRUE ) : void Set a single variable for a set of fields
subform ( mixed $alias, array $fields, array $order = NULL, string $driver = 'group' ) : Formo Create a subform from an array list of fields already in a form
title ( ) : string Return a field's title
to_array ( array $attributes = NULL ) : array Use for casting to json or for sending form objects across an api
val ( $new_val = NULL, $force_new = FALSE )
validate ( ) : boolean Validate all fields and return whether form passed validation
validation ( array $array = NULL ) : Validation Fetch a validation object from a field or form
validation_errors ( Kohana_Validation $validation ) : mixed Format error messages from a validation object according to Formo's formatting rules

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

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

Set up new field
public __construct ( array $array = NULL ) : Formo
$array array (default: NULL)
Результат Formo obj

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

Return a field Retuns NULL if the field doesn't exist
public __get ( mixed $key ) : mixed
$key mixed
Результат mixed

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

Convert just the input to html
public __invoke ( ) : string
Результат string

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

Determine whether a field exists
public __isset ( mixed $key ) : boolean
$key mixed
Результат boolean

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

Add a field to another field. Only works with Formo objects
public __set ( mixed $key, mixed $value ) : void
$key mixed
$value mixed
Результат void

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

Render the Formo object
public __toString ( ) : string
Результат string

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

Add a field or subform to a field or form
public add ( mixed $alias, mixed $driver = NULL, mixed $value = NULL, array $opts = NULL ) : void
$alias mixed
$driver mixed (default: NULL)
$value mixed (default: NULL)
$opts array (default: NULL)
Результат void

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

Add a class tag to the field
public add_class ( mixed $class ) : Formo
$class mixed
Результат Formo obj

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

Add a single rule
public add_rule ( mixed $rule, array $params = NULL ) : Formo
$rule mixed (as array like Validation::rules() or string like Validation::rule())
$params array (only used if $rule isn't an array, default: NULL)
Результат Formo obj

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

Add a single rule accross a group of fields
public add_rule_fields ( array $rule, array $fields ) : void
$rule array
$fields array
Результат void

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

Add multiple rules at a time
public add_rules ( array $array ) : void
$array array
Результат void

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

Add rules for multiple fields
public add_rules_fields ( array $array ) : Formo
$array array
Результат Formo obj

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

Helper method to return the field's alias
public alias ( ) : string
Результат string

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

Return the field or form as an array
public as_array ( mixed $value = NULL, boolean $recursive = FALSE ) : array
$value mixed (default: NULL)
$recursive boolean (default: FALSE)
Результат array

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

Set an html attribute or attributes
public attr ( mixed $get, mixed $set = NULL ) : Formo
$get mixed
$set mixed (default: NULL)
Результат Formo obj

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

Set attributes for a set of fields
public attr_fields ( array $array ) : void
$array array
Результат void

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

public blueprint_deleted ( $field = NULL )

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

public blueprint_dynamic ( $field = NULL )

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

Setup callback or callbacks
public callback ( mixed $type, array $callbacks = NULL ) : Formo
$type mixed
$callbacks array
Результат Formo obj

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

Return the field's closing tag
public close ( ) : string
Результат string

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

Create a copy from form or group object
public copy_blueprint ( array $vals = [] ) : Formo
$vals array (default: array())
Результат Formo

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

Run a method through a field's driver
public driver ( mixed $func, array $args = NULL ) : mixed
$func mixed
$args array (default: NULL)
Результат mixed

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

Get or set a field error
public error ( mixed $message = NULL, array $params = [] ) : mixed
$message mixed (default: NULL)
$params array (default: array())
Результат mixed

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

Get field errors
public errors ( array &$array = NULL ) : array
$array array
Результат array

factory() публичный статический Метод

Simple factory method
public static factory ( array $array = NULL ) : Formo
$array array (default: NULL)
Результат Formo obj

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

Find a field by its alias Returns NULL if field can't be found
public find ( mixed $alias, boolean $not_recursive = FALSE ) : mixed
$alias mixed
$not_recursive boolean (default: FALSE)
Результат mixed

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

Flatten fields in a form
public flatten ( array &$array = NULL ) : Formo
$array array
Результат Formo obj

form() публичный статический Метод

Helper method to return a form field
public static form ( array $array = NULL ) : Formo
$array array (default: NULL)
Результат Formo obj

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

public ftype ( array $array = [] )
$array array

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

Get a field attribute You can use Arr::path dot syntax to retrieve a value
public get ( mixed $var, mixed $default = NULL ) : mixed
$var mixed
$default mixed (default: NULL)
Результат mixed

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

Get or set HTML
public html ( mixed $str = NULL ) : void
$str mixed
Результат void

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

Convert just the input to html
public input ( ) : string
Результат string

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

Return a field's label
public label ( ) : void
Результат void

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

Load an array of alias => value pairs into a form
public load ( array $values = NULL, array $files = NULL ) : Formo
$values array
$files array
Результат Formo

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

Merge a field with an array value with a new array
public merge ( mixed $property, array $array = NULL ) : Formo
$property mixed
$array array (default: NULL)
Результат Formo obj

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

Merge properties for multiple fields
public merge_fields ( array $array ) : Formo
$array array
Результат Formo obj

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

Return a field's HTML 'name' tag value
public name ( ) : string
Результат string

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

Return a field's HTML opening tag
public open ( ) : string
Результат string

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

Reorder a field or multiple fields
public order ( mixed $field, mixed $new_order = NULL, mixed $relative_field = NULL ) : Formo
$field mixed
$new_order mixed (default: NULL)
$relative_field mixed (default: NULL)
Результат Formo obj

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

(Deprecated) Run a method through the ORM driver
public orm ( mixed $method, array $vals = NULL ) : Formo
$method mixed
$vals array (default: NULL)
Результат Formo obj

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

Pad group with number of blueprints
public pad_blueprint ( $count_or_vals = 1 ) : Formo
Результат Formo

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

Find a field's parent If TRUE passed, find the field's parent (return that field if it is the parent)
public parent ( mixed $group_or_form = FALSE ) : mixed
$group_or_form mixed (default: FALSE)
Результат mixed

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

Remove a field or fields from a form
public remove ( mixed $alias ) : Formo
$alias mixed
Результат Formo obj

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

Remove a class or classes
public remove_class ( mixed $class ) : Formo
$class mixed
Результат Formo obj

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

Remove a rule or rules from a field.
public remove_rule ( mixed $rule ) : Formo
$rule mixed (default: NULL)
Результат Formo obj

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

Remove multiple rules at a time
public remove_rules ( array $array ) : void
$array array
Результат void

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

Remove rules for multiple fields
public remove_rules_fields ( mixed $array ) : void
$array mixed
Результат void

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

Render a field from its view file
public render ( $template = NULL ) : string
Результат string

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

Render options (used for select, checkboxes, radios)
public render_opts ( ) : string
Результат string

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

Reset field values to their original values
public reset ( ) : Formo
Результат Formo obj

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

Determine whether a form or field has been sent
public sent ( array $input_array = NULL ) : boolean
$input_array array (default: NULL)
Результат boolean

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

Set a value for a field's attribute You can use Arr::set_path's dot-syntax to set an attribute
public set ( mixed $var, mixed $val = NULL ) : void
$var mixed
$val mixed (default: NULL)
Результат void

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

Set variables for a set of fields
public set_fields ( array $array, boolean $not_recursive = TRUE ) : void
$array array
$not_recursive boolean (default: TRUE)
Результат void

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

Set a single variable for a set of fields
public set_var_fields ( mixed $var, array $array, boolean $not_recursive = TRUE ) : void
$var mixed
$array array
$not_recursive boolean (default: TRUE)
Результат void

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

Create a subform from an array list of fields already in a form
public subform ( mixed $alias, array $fields, array $order = NULL, string $driver = 'group' ) : Formo
$alias mixed
$fields array
$order array (default: NULL)
$driver string (default: 'group')
Результат Formo obj

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

Return a field's title
public title ( ) : string
Результат string

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

Use for casting to json or for sending form objects across an api
public to_array ( array $attributes = NULL ) : array
$attributes array
Результат array

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

public val ( $new_val = NULL, $force_new = FALSE )

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

Validate all fields and return whether form passed validation
public validate ( ) : boolean
Результат boolean

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

Fetch a validation object from a field or form
public validation ( array $array = NULL ) : Validation
$array array (default: NULL)
Результат Validation obj

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

Format error messages from a validation object according to Formo's formatting rules
public validation_errors ( Kohana_Validation $validation ) : mixed
$validation Kohana_Validation
Результат mixed