PHP Class Nette\Forms\Controls\BaseControl

Author: David Grudl
Inheritance: extends Nette\ComponentModel\Component, implements Nette\Forms\IControl
Mostrar archivo Open project: nette/forms Class Usage Examples

Public Properties

Property Type Description
$caption textual caption or label
$idMask string

Protected Properties

Property Type Description
$control control element template
$disabled boolean
$label label element template
$value current control value

Public Methods

Method Description
__call ( $name, $args ) ******************* extension methods ****************d*g*
__construct ( $caption = NULL )
addCondition ( $validator, $value = NULL ) : Rules Adds a validation condition a returns new branch.
addConditionOn ( Nette\Forms\IControl $control, $validator, $value = NULL ) : Rules Adds a validation condition based on another control a returns new branch.
addError ( $message ) : void Adds error message to the list.
addRule ( $validator, $message = NULL, $arg = NULL ) : self Adds a validation rule.
cleanErrors ( ) : void
enableAutoOptionalMode ( ) Globally enables new required/optional behavior.
extensionMethod ( $name, $callback = NULL )
getControl ( ) : Nette\Utils\Html | string Generates control's HTML element.
getControlPart ( ) : Nette\Utils\Html | null
getControlPrototype ( ) : Nette\Utils\Html Returns control's HTML element template.
getError ( ) : string Returns errors corresponding to control.
getErrors ( ) : array Returns errors corresponding to control.
getForm ( $need = TRUE ) : Form Returns form.
getHtmlId ( ) : string Returns control's HTML id.
getHtmlName ( ) : string Returns HTML name of control.
getLabel ( $caption = NULL ) : Nette\Utils\Html | string Generates label's HTML element.
getLabelPart ( ) : Nette\Utils\Html | null
getLabelPrototype ( ) : Nette\Utils\Html Returns label's HTML element template.
getOption ( $key, $default = NULL ) : mixed Returns user-specific option.
getOptions ( ) : array Returns user-specific options.
getRules ( ) : Rules
getTranslator ( ) : Nette\Localization\ITranslator | null Returns translate adapter.
getValue ( ) : mixed Returns control's value.
hasErrors ( ) : boolean
isDisabled ( ) : boolean Is control disabled?
isFilled ( ) : boolean Is control filled?
isOmitted ( ) : boolean Is control value excluded from $form->getValues() result?
isRequired ( ) : boolean Is control mandatory?
loadHttpData ( ) : void Loads HTTP data.
setAttribute ( $name, $value = TRUE ) : self Changes control's HTML attribute.
setDefaultValue ( $value ) : self Sets control's default value.
setDisabled ( $value = TRUE ) : self Disables or enables control.
setHtmlId ( $id ) : self Changes control's HTML id.
setOmitted ( $value = TRUE ) : self Sets whether control value is excluded from $form->getValues() result.
setOption ( $key, $value ) : self Sets user-specific option.
setRequired ( $value = TRUE ) : self Makes control mandatory.
setTranslator ( Nette\Localization\ITranslator $translator = NULL ) : self Sets translate adapter.
setValue ( $value ) : self Sets control's value.
translate ( $value, $count = NULL ) : string Returns translated string.
validate ( ) : void Performs the server side validation.

Protected Methods

Method Description
attached ( $form ) : void This method will be called when the component becomes attached to Form.
getHttpData ( $type, $htmlTail = NULL ) : mixed Loads HTTP data.

Method Details

__call() public method

******************* extension methods ****************d*g*
public __call ( $name, $args )

__construct() public method

public __construct ( $caption = NULL )

addCondition() public method

Adds a validation condition a returns new branch.
public addCondition ( $validator, $value = NULL ) : Rules
return Nette\Forms\Rules new branch

addConditionOn() public method

Adds a validation condition based on another control a returns new branch.
public addConditionOn ( Nette\Forms\IControl $control, $validator, $value = NULL ) : Rules
$control Nette\Forms\IControl
return Nette\Forms\Rules new branch

addError() public method

Adds error message to the list.
public addError ( $message ) : void
return void

addRule() public method

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

attached() protected method

This method will be called when the component becomes attached to Form.
protected attached ( $form ) : void
return void

cleanErrors() public method

public cleanErrors ( ) : void
return void

enableAutoOptionalMode() public static method

This method will be deprecated in next version.
public static enableAutoOptionalMode ( )

extensionMethod() public static method

public static extensionMethod ( $name, $callback = NULL )

getControl() public method

Generates control's HTML element.
public getControl ( ) : Nette\Utils\Html | string
return Nette\Utils\Html | string

getControlPart() public method

public getControlPart ( ) : Nette\Utils\Html | null
return Nette\Utils\Html | null

getControlPrototype() public method

Returns control's HTML element template.
public getControlPrototype ( ) : Nette\Utils\Html
return Nette\Utils\Html

getError() public method

Returns errors corresponding to control.
public getError ( ) : string
return string

getErrors() public method

Returns errors corresponding to control.
public getErrors ( ) : array
return array

getForm() public method

Returns form.
public getForm ( $need = TRUE ) : Form
return Nette\Forms\Form

getHtmlId() public method

Returns control's HTML id.
public getHtmlId ( ) : string
return string

getHtmlName() public method

Returns HTML name of control.
public getHtmlName ( ) : string
return string

getHttpData() protected method

Loads HTTP data.
protected getHttpData ( $type, $htmlTail = NULL ) : mixed
return mixed

getLabel() public method

Generates label's HTML element.
public getLabel ( $caption = NULL ) : Nette\Utils\Html | string
return Nette\Utils\Html | string

getLabelPart() public method

public getLabelPart ( ) : Nette\Utils\Html | null
return Nette\Utils\Html | null

getLabelPrototype() public method

Returns label's HTML element template.
public getLabelPrototype ( ) : Nette\Utils\Html
return Nette\Utils\Html

getOption() public method

Returns user-specific option.
public getOption ( $key, $default = NULL ) : mixed
return mixed

getOptions() public method

Returns user-specific options.
public getOptions ( ) : array
return array

getRules() public method

public getRules ( ) : Rules
return Nette\Forms\Rules

getTranslator() public method

Returns translate adapter.
public getTranslator ( ) : Nette\Localization\ITranslator | null
return Nette\Localization\ITranslator | null

getValue() public method

Returns control's value.
public getValue ( ) : mixed
return mixed

hasErrors() public method

public hasErrors ( ) : boolean
return boolean

isDisabled() public method

Is control disabled?
public isDisabled ( ) : boolean
return boolean

isFilled() public method

Is control filled?
public isFilled ( ) : boolean
return boolean

isOmitted() public method

Is control value excluded from $form->getValues() result?
public isOmitted ( ) : boolean
return boolean

isRequired() public method

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

loadHttpData() public method

Loads HTTP data.
public loadHttpData ( ) : void
return void

setAttribute() public method

Changes control's HTML attribute.
public setAttribute ( $name, $value = TRUE ) : self
return self

setDefaultValue() public method

Sets control's default value.
public setDefaultValue ( $value ) : self
return self

setDisabled() public method

Disables or enables control.
public setDisabled ( $value = TRUE ) : self
return self

setHtmlId() public method

Changes control's HTML id.
public setHtmlId ( $id ) : self
return self

setOmitted() public method

Sets whether control value is excluded from $form->getValues() result.
public setOmitted ( $value = TRUE ) : self
return self

setOption() public method

Sets user-specific option.
public setOption ( $key, $value ) : self
return self

setRequired() public method

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

setTranslator() public method

Sets translate adapter.
public setTranslator ( Nette\Localization\ITranslator $translator = NULL ) : self
$translator Nette\Localization\ITranslator
return self

setValue() public method

Sets control's value.
public setValue ( $value ) : self
return self

translate() public method

Returns translated string.
public translate ( $value, $count = NULL ) : string
return string

validate() public method

Performs the server side validation.
public validate ( ) : void
return void

Property Details

$caption public_oe property

textual caption or label
public $caption

$control protected_oe property

control element template
protected $control

$disabled protected_oe property

protected bool $disabled
return boolean

$idMask public_oe static_oe property

public static string $idMask
return string

$label protected_oe property

label element template
protected $label

$value protected_oe property

current control value
protected $value