PHP Class Nette\Forms\Rules

Author: David Grudl
Inheritance: extends Nette\Object, implements IteratorAggregate
Show file Open project: nette/forms Class Usage Examples

Public Properties

Property Type Description
$defaultMessages

Public Methods

Method Description
__construct ( Nette\Forms\IControl $control )
addCondition ( $validator, $arg = NULL ) : self Adds a validation condition and returns new branch.
addConditionOn ( Nette\Forms\IControl $control, $validator, $arg = NULL ) : self Adds a validation condition on specified control a returns new branch.
addFilter ( $filter ) : self Adds a filter callback.
addRule ( $validator, $message = NULL, $arg = NULL ) : self Adds a validation rule for the current control.
check ( )
elseCondition ( ) : self Adds a else statement.
endCondition ( ) : Rules Ends current validation condition.
getIterator ( ) : ArrayIterator Iterates over complete ruleset.
getToggleStates ( $toggles = [], $success = TRUE ) : array
getToggles ( $actual = FALSE ) : array
isOptional ( )
isRequired ( ) : boolean Is control mandatory?
setRequired ( $value = TRUE ) : self Makes control mandatory.
toggle ( $id, $hide = TRUE ) : self Toggles HTML element visibility.
validate ( $emptyOptional = FALSE ) : boolean Validates against ruleset.
validateRule ( Rule $rule ) : boolean Validates single rule.

Private Methods

Method Description
adjustOperation ( $rule ) : void Process 'operation' string.
getCallback ( $rule )

Method Details

__construct() public method

public __construct ( Nette\Forms\IControl $control )
$control Nette\Forms\IControl

addCondition() public method

Adds a validation condition and returns new branch.
public addCondition ( $validator, $arg = NULL ) : self
return self new branch

addConditionOn() public method

Adds a validation condition on specified control a returns new branch.
public addConditionOn ( Nette\Forms\IControl $control, $validator, $arg = NULL ) : self
$control Nette\Forms\IControl
return self new branch

addFilter() public method

Adds a filter callback.
public addFilter ( $filter ) : self
return self

addRule() public method

Adds a validation rule for the current control.
public addRule ( $validator, $message = NULL, $arg = NULL ) : self
return self

check() public method

public check ( )

elseCondition() public method

Adds a else statement.
public elseCondition ( ) : self
return self else branch

endCondition() public method

Ends current validation condition.
public endCondition ( ) : Rules
return Rules parent branch

getIterator() public method

Iterates over complete ruleset.

getToggleStates() public method

public getToggleStates ( $toggles = [], $success = TRUE ) : array
return array

getToggles() public method

public getToggles ( $actual = FALSE ) : array
return array

isOptional() public method

public isOptional ( )

isRequired() public method

Is control mandatory?
public isRequired ( ) : boolean
return boolean

setRequired() public method

Makes control mandatory.
public setRequired ( $value = TRUE ) : self
return self

toggle() public method

Toggles HTML element visibility.
public toggle ( $id, $hide = TRUE ) : self
return self

validate() public method

Validates against ruleset.
public validate ( $emptyOptional = FALSE ) : boolean
return boolean

validateRule() public static method

Validates single rule.
public static validateRule ( Rule $rule ) : boolean
$rule Rule
return boolean

Property Details

$defaultMessages public static property

Deprecation:
public static $defaultMessages