PHP Class Nette\Forms\Controls\BaseControl

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

Méthodes publiques

Свойство Type Description
$caption textual caption or label
$idMask string

Protected Properties

Свойство Type Description
$control control element template
$disabled boolean
$label label element template
$value current control value

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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 méthode

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

__construct() public méthode

public __construct ( $caption = NULL )

addCondition() public méthode

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

addConditionOn() public méthode

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
Résultat Nette\Forms\Rules new branch

addError() public méthode

Adds error message to the list.
public addError ( $message ) : void
Résultat void

addRule() public méthode

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

attached() protected méthode

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

cleanErrors() public méthode

public cleanErrors ( ) : void
Résultat void

enableAutoOptionalMode() public static méthode

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

extensionMethod() public static méthode

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

getControl() public méthode

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

getControlPart() public méthode

public getControlPart ( ) : Nette\Utils\Html | null
Résultat Nette\Utils\Html | null

getControlPrototype() public méthode

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

getError() public méthode

Returns errors corresponding to control.
public getError ( ) : string
Résultat string

getErrors() public méthode

Returns errors corresponding to control.
public getErrors ( ) : array
Résultat array

getForm() public méthode

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

getHtmlId() public méthode

Returns control's HTML id.
public getHtmlId ( ) : string
Résultat string

getHtmlName() public méthode

Returns HTML name of control.
public getHtmlName ( ) : string
Résultat string

getHttpData() protected méthode

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

getLabel() public méthode

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

getLabelPart() public méthode

public getLabelPart ( ) : Nette\Utils\Html | null
Résultat Nette\Utils\Html | null

getLabelPrototype() public méthode

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

getOption() public méthode

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

getOptions() public méthode

Returns user-specific options.
public getOptions ( ) : array
Résultat array

getRules() public méthode

public getRules ( ) : Rules
Résultat Nette\Forms\Rules

getTranslator() public méthode

Returns translate adapter.
public getTranslator ( ) : Nette\Localization\ITranslator | null
Résultat Nette\Localization\ITranslator | null

getValue() public méthode

Returns control's value.
public getValue ( ) : mixed
Résultat mixed

hasErrors() public méthode

public hasErrors ( ) : boolean
Résultat boolean

isDisabled() public méthode

Is control disabled?
public isDisabled ( ) : boolean
Résultat boolean

isFilled() public méthode

Is control filled?
public isFilled ( ) : boolean
Résultat boolean

isOmitted() public méthode

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

isRequired() public méthode

Is control mandatory?
public isRequired ( ) : boolean
Résultat boolean

loadHttpData() public méthode

Loads HTTP data.
public loadHttpData ( ) : void
Résultat void

setAttribute() public méthode

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

setDefaultValue() public méthode

Sets control's default value.
public setDefaultValue ( $value ) : self
Résultat self

setDisabled() public méthode

Disables or enables control.
public setDisabled ( $value = TRUE ) : self
Résultat self

setHtmlId() public méthode

Changes control's HTML id.
public setHtmlId ( $id ) : self
Résultat self

setOmitted() public méthode

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

setOption() public méthode

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

setRequired() public méthode

Makes control mandatory.
public setRequired ( $value = TRUE ) : self
Résultat self

setTranslator() public méthode

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

setValue() public méthode

Sets control's value.
public setValue ( $value ) : self
Résultat self

translate() public méthode

Returns translated string.
public translate ( $value, $count = NULL ) : string
Résultat string

validate() public méthode

Performs the server side validation.
public validate ( ) : void
Résultat 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
Résultat boolean

$idMask public_oe static_oe property

public static string $idMask
Résultat string

$label protected_oe property

label element template
protected $label

$value protected_oe property

current control value
protected $value