PHP Class Formo_Core_Formo

Afficher le fichier Open project: bmidget/kohana-formo

Méthodes publiques

Méthode Description
__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

Method Details

__construct() public méthode

Set up new field
public __construct ( array $array = NULL ) : Formo
$array array (default: NULL)
Résultat Formo obj

__get() public méthode

Return a field Retuns NULL if the field doesn't exist
public __get ( mixed $key ) : mixed
$key mixed
Résultat mixed

__invoke() public méthode

Convert just the input to html
public __invoke ( ) : string
Résultat string

__isset() public méthode

Determine whether a field exists
public __isset ( mixed $key ) : boolean
$key mixed
Résultat boolean

__set() public méthode

Add a field to another field. Only works with Formo objects
public __set ( mixed $key, mixed $value ) : void
$key mixed
$value mixed
Résultat void

__toString() public méthode

Render the Formo object
public __toString ( ) : string
Résultat string

add() public méthode

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)
Résultat void

add_class() public méthode

Add a class tag to the field
public add_class ( mixed $class ) : Formo
$class mixed
Résultat Formo obj

add_rule() public méthode

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)
Résultat Formo obj

add_rule_fields() public méthode

Add a single rule accross a group of fields
public add_rule_fields ( array $rule, array $fields ) : void
$rule array
$fields array
Résultat void

add_rules() public méthode

Add multiple rules at a time
public add_rules ( array $array ) : void
$array array
Résultat void

add_rules_fields() public méthode

Add rules for multiple fields
public add_rules_fields ( array $array ) : Formo
$array array
Résultat Formo obj

alias() public méthode

Helper method to return the field's alias
public alias ( ) : string
Résultat string

as_array() public méthode

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)
Résultat array

attr() public méthode

Set an html attribute or attributes
public attr ( mixed $get, mixed $set = NULL ) : Formo
$get mixed
$set mixed (default: NULL)
Résultat Formo obj

attr_fields() public méthode

Set attributes for a set of fields
public attr_fields ( array $array ) : void
$array array
Résultat void

blueprint_deleted() public méthode

public blueprint_deleted ( $field = NULL )

blueprint_dynamic() public méthode

public blueprint_dynamic ( $field = NULL )

callback() public méthode

Setup callback or callbacks
public callback ( mixed $type, array $callbacks = NULL ) : Formo
$type mixed
$callbacks array
Résultat Formo obj

close() public méthode

Return the field's closing tag
public close ( ) : string
Résultat string

copy_blueprint() public méthode

Create a copy from form or group object
public copy_blueprint ( array $vals = [] ) : Formo
$vals array (default: array())
Résultat Formo

driver() public méthode

Run a method through a field's driver
public driver ( mixed $func, array $args = NULL ) : mixed
$func mixed
$args array (default: NULL)
Résultat mixed

error() public méthode

Get or set a field error
public error ( mixed $message = NULL, array $params = [] ) : mixed
$message mixed (default: NULL)
$params array (default: array())
Résultat mixed

errors() public méthode

Get field errors
public errors ( array &$array = NULL ) : array
$array array
Résultat array

factory() public static méthode

Simple factory method
public static factory ( array $array = NULL ) : Formo
$array array (default: NULL)
Résultat Formo obj

find() public méthode

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)
Résultat mixed

flatten() public méthode

Flatten fields in a form
public flatten ( array &$array = NULL ) : Formo
$array array
Résultat Formo obj

form() public static méthode

Helper method to return a form field
public static form ( array $array = NULL ) : Formo
$array array (default: NULL)
Résultat Formo obj

ftype() public méthode

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

get() public méthode

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)
Résultat mixed

html() public méthode

Get or set HTML
public html ( mixed $str = NULL ) : void
$str mixed
Résultat void

input() public méthode

Convert just the input to html
public input ( ) : string
Résultat string

label() public méthode

Return a field's label
public label ( ) : void
Résultat void

load() public méthode

Load an array of alias => value pairs into a form
public load ( array $values = NULL, array $files = NULL ) : Formo
$values array
$files array
Résultat Formo

merge() public méthode

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)
Résultat Formo obj

merge_fields() public méthode

Merge properties for multiple fields
public merge_fields ( array $array ) : Formo
$array array
Résultat Formo obj

name() public méthode

Return a field's HTML 'name' tag value
public name ( ) : string
Résultat string

open() public méthode

Return a field's HTML opening tag
public open ( ) : string
Résultat string

order() public méthode

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)
Résultat Formo obj

orm() public méthode

(Deprecated) Run a method through the ORM driver
public orm ( mixed $method, array $vals = NULL ) : Formo
$method mixed
$vals array (default: NULL)
Résultat Formo obj

pad_blueprint() public méthode

Pad group with number of blueprints
public pad_blueprint ( $count_or_vals = 1 ) : Formo
Résultat Formo

parent() public méthode

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)
Résultat mixed

remove() public méthode

Remove a field or fields from a form
public remove ( mixed $alias ) : Formo
$alias mixed
Résultat Formo obj

remove_class() public méthode

Remove a class or classes
public remove_class ( mixed $class ) : Formo
$class mixed
Résultat Formo obj

remove_rule() public méthode

Remove a rule or rules from a field.
public remove_rule ( mixed $rule ) : Formo
$rule mixed (default: NULL)
Résultat Formo obj

remove_rules() public méthode

Remove multiple rules at a time
public remove_rules ( array $array ) : void
$array array
Résultat void

remove_rules_fields() public méthode

Remove rules for multiple fields
public remove_rules_fields ( mixed $array ) : void
$array mixed
Résultat void

render() public méthode

Render a field from its view file
public render ( $template = NULL ) : string
Résultat string

render_opts() public méthode

Render options (used for select, checkboxes, radios)
public render_opts ( ) : string
Résultat string

reset() public méthode

Reset field values to their original values
public reset ( ) : Formo
Résultat Formo obj

sent() public méthode

Determine whether a form or field has been sent
public sent ( array $input_array = NULL ) : boolean
$input_array array (default: NULL)
Résultat boolean

set() public méthode

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)
Résultat void

set_fields() public méthode

Set variables for a set of fields
public set_fields ( array $array, boolean $not_recursive = TRUE ) : void
$array array
$not_recursive boolean (default: TRUE)
Résultat void

set_var_fields() public méthode

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)
Résultat void

subform() public méthode

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')
Résultat Formo obj

title() public méthode

Return a field's title
public title ( ) : string
Résultat string

to_array() public méthode

Use for casting to json or for sending form objects across an api
public to_array ( array $attributes = NULL ) : array
$attributes array
Résultat array

val() public méthode

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

validate() public méthode

Validate all fields and return whether form passed validation
public validate ( ) : boolean
Résultat boolean

validation() public méthode

Fetch a validation object from a field or form
public validation ( array $array = NULL ) : Validation
$array array (default: NULL)
Résultat Validation obj

validation_errors() public méthode

Format error messages from a validation object according to Formo's formatting rules
public validation_errors ( Kohana_Validation $validation ) : mixed
$validation Kohana_Validation
Résultat mixed