__construct()
__toString()
addAttribute()
addFilter()
addRule()
getAttribute()
getAttributeStr()
getAttributes()
getHtml()
getLabel()
getName()
getUnfilteredValue()
getValue()
getViolatedRules()
hasFilter()
hasRule()
isDisabled()
isHidden()
isIgnored()
printInfo()
setAttributes()
setData()
setDisabled()
setFixed()
setHidden()
setIgnore()
setMultiple()
setReadonly()
setRequiredAttributes()
setValue()
validate()
_buildAttributeStr()
_buildOptions()
_filterValue()
_getMultipleSelect()
_getSingleSelect()
_init()
_validateItemValue()
_makeDomId()
$_attributes
$_data
$_filters
$_isDisabled
$_isFixed
$_isHidden
$_isIgnored
$_isReadonly
$_label
$_multi
$_name
$_requiredAttributes
$_rules
$_value
$_filteredValue
$_violatedRules
formagicItemSelect
category | Formagic |
---|---|
package | Item |
author | Florian Sonnenburg |
copyright | Copyright (c) 2007 |
version | $Id: Select.php 169 2012-05-06 20:16:16Z meweasle $ |
access | public |
__construct(string $name, array $arguments) : void
inherited_from | \Formagic_Item_Abstract::__construct() |
---|
string
Name of item
array
Additional arguments
\Formagic_Exception |
---|
__toString() : string
inherited_from | \Formagic_Item_Abstract::__toString() |
---|
string
The HTML string representation.addAttribute(string $name, string $value) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
inherited_from | \Formagic_Item_Abstract::addAttribute() |
---|
string
Attribute name
string
Attribute value
\Formagic_Item_Abstract
This object.addFilter(mixed $filter, array $args) : \Formagic_Item_Abstract
Formagic items can have multiple filters which will be applied in the order they are passed to the object.
First parameter $filter can either be a string or an object of a class that extends Formagic_Filter_Interface. A string value is assumed to be the type of filter to be added.
This method throws an exception if no valid role object can be identified.
Implements a fluent interface pattern.
inherited_from | \Formagic_Item_Abstract::addFilter() |
---|
mixed
Filter type string or Formagic_Filter_Interface object.
array
Optional array of arguments. Will be passed to the filter constructor as array.
\Formagic_Exception |
---|
\Formagic_Item_Abstract
Fluent interfaceaddRule(mixed $rule, array $args) : \Formagic_Item_Abstract
Formagic items can have multiple rules which will be applied in the order they are passed to the object.
First parameter $rule can either be a string or an instance of a class that extends Formagic_Rule_Abstract. A string value is assumed to be the type of rule to be added.
Implements a fluent interface pattern.
inherited_from | \Formagic_Item_Abstract::addRule() |
---|
mixed
Rule type string or Formagic_Rule_Abstract object.
array
Optional array of arguments. Will be passed to the rule constructor as array.
\Formagic_Exception |
If no valid role object can be identified. |
---|
\Formagic_Item_Abstract
This object.getAttribute(string $name) : string
see | \Formagic_Item_Abstract::setAttributes() |
---|---|
see | \Formagic_Item_Abstract::addAttribute() |
inherited_from | \Formagic_Item_Abstract::getAttribute() |
string
Name of the attribute value to fetch
string
Attribute valuegetAttributeStr() : string
Takes the attributes array and transforms it into a string that can be directly inserted into a HTML tag. The string will be built with a trailing space character.
Two default attributes are added to the attributes string: "name" and "id". If you want to skip these, add them to your attributes on item generation or via setAttributes() or addAttribute() with NULL as value.
$item->setAttributes(array('class' => 'myclass', 'onclick' => 'alert('Formagic');'));
$string = $item->getAttributeStr();
echo '';
// output will be:
//
see | \Formagic_Item_Abstract::setAttributes() |
---|---|
see | \Formagic_Item_Abstract::addAttribute() |
inherited_from | \Formagic_Item_Abstract::getAttributeStr() |
string
The attributes string.getAttributes() : array
see | \Formagic_Item_Abstract::setAttributes() |
---|---|
see | \Formagic_Item_Abstract::addAttribute() |
inherited_from | \Formagic_Item_Abstract::getAttributes() |
array
The attributes array.getHtml() : string
Should be overwritten by subclasses.
\Formagic_Exception |
if no options defined |
---|
string
The string representation.getLabel() : string
inherited_from | \Formagic_Item_Abstract::getLabel() |
---|
string
The label string.getName() : string
inherited_from | \Formagic_Item_Abstract::getName() |
---|
string
The item namegetUnfilteredValue() : mixed
inherited_from | \Formagic_Item_Abstract::getUnfilteredValue() |
---|
mixed
The unfiltered item valuegetValue() : mixed
inherited_from | \Formagic_Item_Abstract::getValue() |
---|
mixed
The filtered item valuegetViolatedRules() : array
If no rules were violated or if no validation has been performed yet, an empty array will be returned.
inherited_from | \Formagic_Item_Abstract::getViolatedRules() |
---|
array
The violated rules.hasFilter(string $filterName) : boolean
inherited_from | \Formagic_Item_Abstract::hasFilter() |
---|
string
Filter name
boolean
Check valuehasRule(string $ruleName) : boolean
The $ruleName parameter has to be a string with the name of rule that is looked for. If you want to know for example if the item has the mandatory rule added, $ruleName would have to be 'mandatory'.
The search string is case insensitive.
addRule($mandatory);
// look for the rule
$ruleExists = $item->hasRule('mandatory'); // would return TRUE
$ruleExists = $item->hasRule('Mandatory'); // would return TRUE
$ruleExists = $item->hasRule('Formagic_Rule_Mandatory'); // would return FALSE
?>
inherited_from | \Formagic_Item_Abstract::hasRule() |
---|
string
Rule name, eg. 'Mandatory'
boolean
isDisabled() : boolean
inherited_from | \Formagic_Item_Abstract::isDisabled() |
---|
boolean
The disabled status.isHidden() : boolean
inherited_from | \Formagic_Item_Abstract::isHidden() |
---|
boolean
The hidden status.isIgnored() : boolean
inherited_from | \Formagic_Item_Abstract::isIgnored() |
---|
boolean
The ignored status.printInfo() : string
inherited_from | \Formagic_Item_Abstract::printInfo() |
---|
string
The item information stringsetAttributes(array $attArray) : \Formagic_Item_Abstract
Mainly used for additional HTML attributes other than "name", "id" or "value", such as "style", "class", javascript-handlers etc. Attributes are added corresponding to key->value-pairs in $attArray.
setAttributes() will overwrite any previously added item attributes.
Implements a fluent interface pattern.
see | \Formagic_Item_Abstract::addAttribute() |
---|---|
inherited_from | \Formagic_Item_Abstract::setAttributes() |
array
The new
\Formagic_Item_Abstract
This object.setDisabled(boolean $flag) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
inherited_from | \Formagic_Item_Abstract::setDisabled() |
---|
boolean
Defined item's disabled status.
\Formagic_Item_Abstract
Fluent interfacesetFixed(boolean $flag) : \Formagic_Item_Abstract
If set to true, all following calls to setValue() will be ignored.
Implements a fluent interface pattern.
inherited_from | \Formagic_Item_Abstract::setFixed() |
---|
boolean
IsFixed flag value.
\Formagic_Item_Abstract
This object.setHidden(boolean $flag) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
inherited_from | \Formagic_Item_Abstract::setHidden() |
---|
boolean
Hidden status flag.
\Formagic_Item_Abstract
This object.setIgnore(boolean $flag) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
inherited_from | \Formagic_Item_Abstract::setIgnore() |
---|
boolean
Ignored status flag.
\Formagic_Item_Abstract
This object.setMultiple(boolean $flag) : \Formagic_Item_Select
boolean
Bool value if the field has to be multiple.
\Formagic_Item_Select
$this objectsetReadonly(boolean $flag) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
inherited_from | \Formagic_Item_Abstract::setReadonly() |
---|
boolean
Readonly status flag.
\Formagic_Item_Abstract
This object.setRequiredAttributes(array $requiredAttributes) : \Formagic_Item_Abstract
Default required attributes are "id" and "name".
inherited_from | \Formagic_Item_Abstract::setRequiredAttributes() |
---|
array
Numeric array of required attributes.
\Formagic_Item_Abstract
Fluent interface.setValue(mixed $value) : \Formagic_Item_Abstract
Implements a fluent interface pattern.
inherited_from | \Formagic_Item_Abstract::setValue() |
---|
mixed
The new item value.
\Formagic_Item_Abstract
This object.validate() : boolean
Iterates through all defined rules of Formagic item. Returns true if all rules apply or false otherwise.
inherited_from | \Formagic_Item_Abstract::validate() |
---|
boolean
The validation result._buildAttributeStr(array $attributes) : string
inherited_from | \Formagic_Item_Abstract::_buildAttributeStr() |
---|
array
array of attributes
string
Attributes string_buildOptions(array $data, string $currentVal) : string
array
Select options
string
Current value
string
Options string_filterValue(Formagic_Filter_Interface $filter, mixed $subject) : mixed
inherited_from | \Formagic_Item_Abstract::_filterValue() |
---|
mixed
Scalar or array
mixed
Filtered scalar or array_getMultipleSelect() : string
string
The HTML string._getSingleSelect() : string
string
The HTML string._init(array $additionalArgs) : void
Supported arguments:
see | \setData() |
---|---|
see | \setMultiple() |
array
Array of additional options for this item
_validateItemValue(Formagic_Rule_Abstract $rule, string | array $subject) : boolean
inherited_from | \Formagic_Item_Abstract::_validateItemValue() |
---|
stringarray
Validation subject
boolean
Validation result_makeDomId(string $str) : string
inherited_from | \Formagic_Item_Abstract::_makeDomId() |
---|
string
String to convert to a DOM ID
string
Valid DOM ID$_attributes : array
inherited_from | \Formagic_Item_Abstract::$$_attributes |
---|
$_data : array
$_filters : array
inherited_from | \Formagic_Item_Abstract::$$_filters |
---|
$_isDisabled : boolean
inherited_from | \Formagic_Item_Abstract::$$_isDisabled |
---|
$_isFixed : boolean
inherited_from | \Formagic_Item_Abstract::$$_isFixed |
---|
$_isHidden : boolean
inherited_from | \Formagic_Item_Abstract::$$_isHidden |
---|
$_isIgnored : boolean
inherited_from | \Formagic_Item_Abstract::$$_isIgnored |
---|
$_isReadonly : boolean
inherited_from | \Formagic_Item_Abstract::$$_isReadonly |
---|
$_label : boolean
inherited_from | \Formagic_Item_Abstract::$$_label |
---|
$_multi : boolean
$_name : string
inherited_from | \Formagic_Item_Abstract::$$_name |
---|
$_requiredAttributes : array
inherited_from | \Formagic_Item_Abstract::$$_requiredAttributes |
---|
$_rules : array
inherited_from | \Formagic_Item_Abstract::$$_rules |
---|
$_value : mixed
inherited_from | \Formagic_Item_Abstract::$$_value |
---|
$_filteredValue : mixed
inherited_from | \Formagic_Item_Abstract::$$_filteredValue |
---|
$_violatedRules : \Form_Rule_Abstract
inherited_from | \Formagic_Item_Abstract::$$_violatedRules |
---|