PHP 클래스 Formo_Core_Formo

파일 보기 프로젝트 열기: bmidget/kohana-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