PHP Class Gregwar\Formidable\Form

Author: Grégoire Passault ([email protected])
Mostra file Open project: gregwar/formidable Class Usage Examples

Public Properties

Property Type Description
$isCached Is the form cached?

Protected Properties

Property Type Description
$accessor Property accessor
$cache * Cache system
$constraints Form constraints
$content HTML contents of the form
$factory Factory
$originalParserData Parser raw data
$parserData
$path File path
$position Current position for iterator
$variables File variables

Public Methods

Method Description
__construct ( $pathOrContent = '', $variables = null, $cache = false, $factory = null )
__get ( $name ) Get a field's value
__set ( $var, $val ) Set a field value
__toString ( ) Convert to HTML
addConstraint ( $name, $closure = null ) Add a constraint on a field
check ( ) Error checking
getAttribute ( $name, $attribute ) Get a field attribute
getContent ( ) Get the form contents
getData ( $entity = [] ) Gets the data using mapping
getFactory ( )
getField ( $name ) Get a field
getFields ( )
getHtml ( ) Convert to HTML
getJs ( ) Get the JavaScript code to embed
getParserData ( ) Gets the parser data
getPostIndicator ( ) Get the CSRF manager
getToken ( ) Gets the post indicator
getValue ( $name ) Gets a field value
getValues ( ) Get all the values
handle ( $callback = null, $errorsCallback = null ) Check a form, helper function
hookNames ( Closure $hook )
posted ( $method = 'post' ) Check if the form was posted
reset ( ) Resets the form
setAttribute ( $name, $attribute, $value ) Defines an attribute value
setData ( $entity ) Define the values using mapping
setLanguage ( Language $language ) Sets the language
setOptionClass ( $select, $val, $class ) Sets the class of an option field
setPlaceholder ( $name, $value ) Defines a placeholder value
setValue ( $name, $value ) Defines a field value
setValues ( $values, array $files = [] ) Define the values
source ( $source, $data ) Values sourcing

Protected Methods

Method Description
parse ( ) Parses the form contents to build objects
pushLanguage ( ) Push the language to all the fields

Method Details

__construct() public method

public __construct ( $pathOrContent = '', $variables = null, $cache = false, $factory = null )

__get() public method

Get a field's value
public __get ( $name )

__set() public method

Set a field value
public __set ( $var, $val )

__toString() public method

Convert to HTML
public __toString ( )

addConstraint() public method

Add a constraint on a field
public addConstraint ( $name, $closure = null )

check() public method

Error checking
public check ( )

getAttribute() public method

Get a field attribute
public getAttribute ( $name, $attribute )

getContent() public method

Get the form contents
public getContent ( )

getData() public method

Gets the data using mapping
public getData ( $entity = [] )

getFactory() public method

public getFactory ( )

getField() public method

Get a field
public getField ( $name )

getFields() public method

public getFields ( )

getHtml() public method

Convert to HTML
public getHtml ( )

getJs() public method

Get the JavaScript code to embed
public getJs ( )

getParserData() public method

Gets the parser data
public getParserData ( )

getPostIndicator() public method

Get the CSRF manager
public getPostIndicator ( )

getToken() public method

Gets the post indicator
public getToken ( )

getValue() public method

Gets a field value
public getValue ( $name )

getValues() public method

Get all the values
public getValues ( )

handle() public method

Check a form, helper function
public handle ( $callback = null, $errorsCallback = null )

hookNames() public method

public hookNames ( Closure $hook )
$hook Closure

parse() protected method

Parses the form contents to build objects
protected parse ( )

posted() public method

Check if the form was posted
public posted ( $method = 'post' )

pushLanguage() protected method

Push the language to all the fields
protected pushLanguage ( )

reset() public method

Resets the form
public reset ( )

setAttribute() public method

Defines an attribute value
public setAttribute ( $name, $attribute, $value )

setData() public method

Define the values using mapping
public setData ( $entity )

setLanguage() public method

Sets the language
public setLanguage ( Language $language )
$language Gregwar\Formidable\Language\Language

setOptionClass() public method

Sets the class of an option field
public setOptionClass ( $select, $val, $class )

setPlaceholder() public method

Defines a placeholder value
public setPlaceholder ( $name, $value )

setValue() public method

Defines a field value
public setValue ( $name, $value )

setValues() public method

Define the values
public setValues ( $values, array $files = [] )
$files array

source() public method

Values sourcing
public source ( $source, $data )

Property Details

$accessor protected_oe property

Property accessor
protected $accessor

$cache protected_oe property

* Cache system
protected $cache

$constraints protected_oe property

Form constraints
protected $constraints

$content protected_oe property

HTML contents of the form
protected $content

$factory protected_oe property

Factory
protected $factory

$isCached public_oe property

Is the form cached?
public $isCached

$originalParserData protected_oe property

Parser raw data
protected $originalParserData

$parserData protected_oe property

protected $parserData

$path protected_oe property

File path
protected $path

$position protected_oe property

Current position for iterator
protected $position

$variables protected_oe property

File variables
protected $variables