PHP Class Former\Traits\Field

Inheritance: extends Former\Traits\FormerObject, implements Former\Interfaces\FieldInterface
Afficher le fichier Open project: anahkiasen/former Class Usage Examples

Protected Properties

Свойство Type Description
$app Illuminate\Container\Container The IoC Container
$bind string The field's bind destination
$element string The field's default element
$form Former\Former\Form The Form instance
$group Former\Form\Group The field's group
$isSelfClosing boolean Whether the Field is self-closing or not
$label string A label for the field (if not using Bootstrap)

Méthodes publiques

Méthode Description
__call ( string $method, $parameters ) Redirect calls to the group if necessary
__construct ( Illuminate\Container\Container $app, string $type, $name, $label, $value, $attributes ) Set up a Field instance
__toString ( ) : string Prints out the field
bind ( $destination ) Change the field's bind destination
forceValue ( string $value ) Set the Field value no matter what
getLabel ( ) : string Get the field's labels
getRules ( ) : array Get the rules applied to the current field
isButton ( ) : boolean Check if the field is a button
isCheckable ( ) : boolean Check if field is a checkbox or a radio
isRequired ( ) : boolean Whether the current field is required or not
isUnwrappable ( ) : boolean Check if a field is unwrappable (no label)
label ( string $text, array $attributes = [] ) : Field Adds a label to the group/field
name ( string $name ) Change the field's name
rule ( string $rule ) Apply a Live Validation rule by chaining
rules ( $rules ) Apply multiple rules passed as a string.
value ( string $value ) Classic setting of attribute, won't overwrite any populate() attempt
wrapAndRender ( ) : string Prints out the field, wrapped in its group

Méthodes protégées

Méthode Description
currentFramework ( ) : Former\Traits\Framework Get the current framework instance

Private Methods

Méthode Description
automaticLabels ( string $name, string $label ) : false | null Ponders a label and a field name, and tries to get the best out of it
repopulate ( $fallback = null ) Use values stored in Former to populate the current field

Method Details

__call() public méthode

Redirect calls to the group if necessary
public __call ( string $method, $parameters )
$method string

__construct() public méthode

Set up a Field instance
public __construct ( Illuminate\Container\Container $app, string $type, $name, $label, $value, $attributes )
$app Illuminate\Container\Container
$type string A field type

__toString() public méthode

Prints out the field
public __toString ( ) : string
Résultat string

bind() public méthode

Change the field's bind destination
public bind ( $destination )
$destination

currentFramework() protected méthode

Get the current framework instance
protected currentFramework ( ) : Former\Traits\Framework
Résultat Former\Traits\Framework

forceValue() public méthode

Set the Field value no matter what
public forceValue ( string $value )
$value string A new value

getLabel() public méthode

Get the field's labels
public getLabel ( ) : string
Résultat string

getRules() public méthode

Get the rules applied to the current field
public getRules ( ) : array
Résultat array An array of rules

isButton() public méthode

Check if the field is a button
public isButton ( ) : boolean
Résultat boolean

isCheckable() public méthode

Check if field is a checkbox or a radio
public isCheckable ( ) : boolean
Résultat boolean

isRequired() public méthode

Whether the current field is required or not
public isRequired ( ) : boolean
Résultat boolean

isUnwrappable() public méthode

Check if a field is unwrappable (no label)
public isUnwrappable ( ) : boolean
Résultat boolean

label() public méthode

Adds a label to the group/field
public label ( string $text, array $attributes = [] ) : Field
$text string A label
$attributes array The label's attributes
Résultat Field A field

name() public méthode

Change the field's name
public name ( string $name )
$name string The new name

rule() public méthode

Apply a Live Validation rule by chaining
public rule ( string $rule )
$rule string The rule

rules() public méthode

Apply multiple rules passed as a string.
public rules ( $rules )
$rules

value() public méthode

Classic setting of attribute, won't overwrite any populate() attempt
public value ( string $value )
$value string A new value

wrapAndRender() public méthode

Prints out the field, wrapped in its group
public wrapAndRender ( ) : string
Résultat string

Property Details

$app protected_oe property

The IoC Container
protected Container,Illuminate\Container $app
Résultat Illuminate\Container\Container

$bind protected_oe property

The field's bind destination
protected string $bind
Résultat string

$element protected_oe property

The field's default element
protected string $element
Résultat string

$form protected_oe property

The Form instance
protected Form,Former\Former $form
Résultat Former\Former\Form

$group protected_oe property

The field's group
protected Group,Former\Form $group
Résultat Former\Form\Group

$isSelfClosing protected_oe property

Whether the Field is self-closing or not
protected bool $isSelfClosing
Résultat boolean

$label protected_oe property

A label for the field (if not using Bootstrap)
protected string $label
Résultat string