PHP Class formHelper, nodejs-autorestart

Datei anzeigen Open project: shimondoodkin/nodejs-autorestart Class Usage Examples

Public Properties

Property Type Description
$checkboxes Cache containing individual radio or checkbox elements in an array
$radios Cache containing individual radio or checkbox elements in an array

Protected Properties

Property Type Description
$_staticTypes array Form types that do not change value with user input

Public Methods

Method Description
getCheckboxes ( array $args ) : str Returns a set of checkbox form elements
getErrorMessageContainer ( string $id, string $errorMessage = '' ) : string Returns a standardized container to wrap an error message
getFormClose ( ) : string Closes a form if one is open
getFormOpen ( array $args = [] ) : string Begins a form Includes a safety mechanism to prevent re-opening an already-open form
getInput ( array $args ) : string Used for text, textarea, hidden, password, file, button, image and submit
getRadios ( array $args ) : str Returns a set of radio form elements
getSelect ( array $args ) : str Returns a form select element

Protected Methods

Method Description
_getLabel ( array $args, str $formElement ) : str Adds label tags to a form element
_getProperties ( array $args, array $propertyNames = [] ) : array Sets the standard properties available to all input elements in addition to user-defined properties Standard properties are: name, value, class, style, id
_indexDynamicArray ( string $name ) : string Converts dynamically-assigned array indecies to use an explicitely defined index

Method Details

_getLabel() protected method

Adds label tags to a form element
protected _getLabel ( array $args, str $formElement ) : str
$args array
$formElement str
return str

_getProperties() protected method

Sets the standard properties available to all input elements in addition to user-defined properties Standard properties are: name, value, class, style, id
protected _getProperties ( array $args, array $propertyNames = [] ) : array
$args array
$propertyNames array Optional, an array of user-defined properties
return array

_indexDynamicArray() protected method

Converts dynamically-assigned array indecies to use an explicitely defined index
protected _indexDynamicArray ( string $name ) : string
$name string
return string

getCheckboxes() public method

This method essentially extends the getRadios method and uses an identical signature except that $args['value'] can also accept an array of values to be checked.
public getCheckboxes ( array $args ) : str
$args array
return str

getErrorMessageContainer() public method

Returns a standardized container to wrap an error message
public getErrorMessageContainer ( string $id, string $errorMessage = '' ) : string
$id string
$errorMessage string Optional, you may want to leave this blank and populate dynamically via JavaScript
return string

getFormClose() public method

Closes a form if one is open
public getFormClose ( ) : string
return string

getFormOpen() public method

Begins a form Includes a safety mechanism to prevent re-opening an already-open form
public getFormOpen ( array $args = [] ) : string
$args array
return string

getInput() public method

Valid args are any properties valid within an HTML input as well as label
public getInput ( array $args ) : string
$args array
return string

getRadios() public method

array( 'name' => '', 'value' => '', 'id' => '', 'legend' => '', 'options' => array('value1' => 'text1', 'value2' => 'text2', 'value3' => 'text3'), 'options' => array('text1', 'text2', 'text3'), //also acceptable (cannot do half this, half above syntax) )
public getRadios ( array $args ) : str
$args array
return str

getSelect() public method

$args = array( 'name' => '', 'multiple' => true, 'leadingOptions' => array(), 'optgroups' => array('group 1' => array('label' => 'g1o1', 'value' => 'grp 1 opt 1'), 'group 2' => array(),), 'options' => array('value1' => 'text1', 'value2' => 'text2', 'value3' => 'text3'), 'value' => array('value2', 'value3') //if (multiple==false) 'value' => (str) 'value3' );
public getSelect ( array $args ) : str
$args array
return str

Property Details

$_staticTypes protected_oe property

Form types that do not change value with user input
protected array $_staticTypes
return array

$checkboxes public_oe property

Cache containing individual radio or checkbox elements in an array
public $checkboxes

$radios public_oe property

Cache containing individual radio or checkbox elements in an array
public $radios