category |
Formagic |
package |
Item |
author |
Florian Sonnenburg |
copyright |
Copyright (c) 2010 |
version |
$Id: Text.php 160 2012-04-02 20:18:14Z meweasle $ |
Methods
Constructor
__construct(string $name, array $arguments) : void
Inherited
inherited_from |
\Formagic_Item_Abstract::__construct() |
inherited_from |
\Formagic_Item_Input::__construct() |
Parameters
$arguments
array
Additional arguments
Exceptions
Returns the HTML string representation of the form item.
__toString() : string
Inherited
inherited_from |
\Formagic_Item_Abstract::__toString() |
inherited_from |
\Formagic_Item_Input::__toString() |
Returns
string
The HTML string representation.
Adds an HTML attribute to the attributes stack.
addAttribute(string $name, string $value) : \Formagic_Item_Abstract
Inherited
Implements a fluent interface pattern.
inherited_from |
\Formagic_Item_Abstract::addAttribute() |
inherited_from |
\Formagic_Item_Input::addAttribute() |
Parameters
$name
string
Attribute name
$value
string
Attribute value
Returns
Adds filter object to Formagic item
addFilter(mixed $filter, array $args) : \Formagic_Item_Abstract
Inherited
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() |
inherited_from |
\Formagic_Item_Input::addFilter() |
Parameters
$filter
mixed
Filter type string or Formagic_Filter_Interface object.
$args
array
Optional array of arguments. Will be passed to the filter constructor as array.
Exceptions
Returns
Adds rule object to Formagic item
addRule(mixed $rule, array $args) : \Formagic_Item_Abstract
Inherited
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() |
inherited_from |
\Formagic_Item_Input::addRule() |
Parameters
$rule
mixed
Rule type string or Formagic_Rule_Abstract object.
$args
array
Optional array of arguments. Will be passed to the rule constructor as array.
Exceptions
Returns
Returns value of an attribute for this item.
getAttribute(string $name) : string
Inherited
see |
\Formagic_Item_Abstract::setAttributes() |
see |
\Formagic_Item_Abstract::addAttribute() |
inherited_from |
\Formagic_Item_Abstract::getAttribute() |
inherited_from |
\Formagic_Item_Input::getAttribute() |
Parameters
$name
string
Name of the attribute value to fetch
Returns
string
Attribute value
Returns attribute string for HTML tag.
getAttributeStr() : string
Inherited
Returns the attributes array for this item.
getAttributes() : array
Inherited
see |
\Formagic_Item_Abstract::setAttributes() |
see |
\Formagic_Item_Abstract::addAttribute() |
inherited_from |
\Formagic_Item_Abstract::getAttributes() |
inherited_from |
\Formagic_Item_Input::getAttributes() |
Returns
array
The attributes array.
HTML string representation of text input field
getHtml() : string
Inherited
Should be overwritten by subclasses.
inherited_from |
\Formagic_Item_Input::getHtml() |
Returns
string
Returns label for this item.
getLabel() : string
Inherited
inherited_from |
\Formagic_Item_Abstract::getLabel() |
inherited_from |
\Formagic_Item_Input::getLabel() |
Returns
string
The label string.
Returns the item name.
getName() : string
Inherited
inherited_from |
\Formagic_Item_Abstract::getName() |
inherited_from |
\Formagic_Item_Input::getName() |
Returns
string
The item name
Returns current unfiltered value for this item.
getUnfilteredValue() : mixed
Inherited
inherited_from |
\Formagic_Item_Abstract::getUnfilteredValue() |
inherited_from |
\Formagic_Item_Input::getUnfilteredValue() |
Returns
mixed
The unfiltered item value
Returns the current filtered value for this item.
getValue() : mixed
Inherited
inherited_from |
\Formagic_Item_Abstract::getValue() |
inherited_from |
\Formagic_Item_Input::getValue() |
Returns
mixed
The filtered item value
Returns array of violated rules.
getViolatedRules() : array
Inherited
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() |
inherited_from |
\Formagic_Item_Input::getViolatedRules() |
Returns
array
The violated rules.
Checks if a specific filter is defined for a Formagic item.
hasFilter(string $filterName) : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::hasFilter() |
inherited_from |
\Formagic_Item_Input::hasFilter() |
Parameters
$filterName
string
Filter name
Returns
boolean
Check value
Tells if a rule exists for this item.
hasRule(string $ruleName) : boolean
Inherited
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() |
inherited_from |
\Formagic_Item_Input::hasRule() |
Parameters
$ruleName
string
Rule name, eg. 'Mandatory'
Returns
boolean
Returns disabled status of item
isDisabled() : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::isDisabled() |
inherited_from |
\Formagic_Item_Input::isDisabled() |
Returns
boolean
The disabled status.
Returns hidden status of item
isHidden() : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::isHidden() |
inherited_from |
\Formagic_Item_Input::isHidden() |
Returns
boolean
The hidden status.
Returns ignore status of item
isIgnored() : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::isIgnored() |
inherited_from |
\Formagic_Item_Input::isIgnored() |
Returns
boolean
The ignored status.
Prints item infos.
printInfo() : string
Inherited
inherited_from |
\Formagic_Item_Abstract::printInfo() |
inherited_from |
\Formagic_Item_Input::printInfo() |
Returns
string
The item information string
Sets additional attributes for this item.
setAttributes(array $attArray) : \Formagic_Item_Abstract
Inherited
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() |
inherited_from |
\Formagic_Item_Input::setAttributes() |
Parameters
Returns
Sets disabled flag for item and removes it from form
setDisabled(boolean $flag) : \Formagic_Item_Abstract
Inherited
Implements a fluent interface pattern.
inherited_from |
\Formagic_Item_Abstract::setDisabled() |
inherited_from |
\Formagic_Item_Input::setDisabled() |
Parameters
$flag
boolean
Defined item's disabled status.
Returns
Sets isFixed flag.
setFixed(boolean $flag) : \Formagic_Item_Abstract
Inherited
If set to true, all following calls to setValue() will
be ignored.
Implements a fluent interface pattern.
inherited_from |
\Formagic_Item_Abstract::setFixed() |
inherited_from |
\Formagic_Item_Input::setFixed() |
Parameters
$flag
boolean
IsFixed flag value.
Returns
Sets hidden flag for item.
setHidden(boolean $flag) : \Formagic_Item_Abstract
Inherited
Implements a fluent interface pattern.
inherited_from |
\Formagic_Item_Abstract::setHidden() |
inherited_from |
\Formagic_Item_Input::setHidden() |
Parameters
$flag
boolean
Hidden status flag.
Returns
Defines if the item will be ignored in form submit.
setIgnore(boolean $flag) : \Formagic_Item_Abstract
Inherited
Implements a fluent interface pattern.
inherited_from |
\Formagic_Item_Abstract::setIgnore() |
inherited_from |
\Formagic_Item_Input::setIgnore() |
Parameters
$flag
boolean
Ignored status flag.
Returns
Sets readonly flag
setReadonly(boolean $flag) : \Formagic_Item_Abstract
Inherited
Implements a fluent interface pattern.
inherited_from |
\Formagic_Item_Abstract::setReadonly() |
inherited_from |
\Formagic_Item_Input::setReadonly() |
Parameters
$flag
boolean
Readonly status flag.
Returns
Defines which attributes are always to be added to this input element.
setRequiredAttributes(array $requiredAttributes) : \Formagic_Item_Abstract
Inherited
Default required attributes are "id" and "name".
inherited_from |
\Formagic_Item_Abstract::setRequiredAttributes() |
inherited_from |
\Formagic_Item_Input::setRequiredAttributes() |
Parameters
$requiredAttributes
array
Numeric array of required attributes.
Returns
Sets the item value to $value.
setValue(mixed $value) : \Formagic_Item_Abstract
Inherited
Implements a fluent interface pattern.
inherited_from |
\Formagic_Item_Abstract::setValue() |
inherited_from |
\Formagic_Item_Input::setValue() |
Parameters
$value
mixed
The new item value.
Returns
Performs rule checks
validate() : boolean
Inherited
Iterates through all defined rules of Formagic item. Returns true if all
rules apply or false otherwise.
inherited_from |
\Formagic_Item_Abstract::validate() |
inherited_from |
\Formagic_Item_Input::validate() |
Returns
boolean
The validation result.
Assembles attribute string in HTML-conform style
_buildAttributeStr(array $attributes) : string
Inherited
inherited_from |
\Formagic_Item_Abstract::_buildAttributeStr() |
inherited_from |
\Formagic_Item_Input::_buildAttributeStr() |
Parameters
$attributes
array
array of attributes
Returns
string
Attributes string
Filters a value
_filterValue(Formagic_Filter_Interface $filter, mixed $subject) : mixed
Inherited
inherited_from |
\Formagic_Item_Abstract::_filterValue() |
inherited_from |
\Formagic_Item_Input::_filterValue() |
Parameters
$subject
mixed
Scalar or array
Returns
mixed
Filtered scalar or array
Allow subclass initialization.
_init(array $additionalArgs) : void
Inherited
inherited_from |
\Formagic_Item_Abstract::_init() |
inherited_from |
\Formagic_Item_Input::_init() |
Parameters
$additionalArgs
array
Array of arguments that are not processed by superclass.
Perform validation on item value.
_validateItemValue(Formagic_Rule_Abstract $rule, string | array $subject) : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::_validateItemValue() |
inherited_from |
\Formagic_Item_Input::_validateItemValue() |
Parameters
$subject
stringarray
Validation subject
Returns
boolean
Validation result
Takes a string and returns a valid DOM ID.
_makeDomId(string $str) : string
Inherited
inherited_from |
\Formagic_Item_Abstract::_makeDomId() |
inherited_from |
\Formagic_Item_Input::_makeDomId() |
Parameters
$str
string
String to convert to a DOM ID
Returns
string
Valid DOM ID
Properties
Additional attributes for item HTML tag
$_attributes : array
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_attributes |
inherited_from |
\Formagic_Item_Input::$$_attributes |
Array of input filters for this item
$_filters : array
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_filters |
inherited_from |
\Formagic_Item_Input::$$_filters |
Determines if item is removed from Formagic form.
$_isDisabled : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_isDisabled |
inherited_from |
\Formagic_Item_Input::$$_isDisabled |
Determines if value can be changed.
$_isFixed : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_isFixed |
inherited_from |
\Formagic_Item_Input::$$_isFixed |
Determines if item will be displayed
$_isHidden : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_isHidden |
inherited_from |
\Formagic_Item_Input::$$_isHidden |
Determines if item content should be interpreted after submit.
$_isIgnored : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_isIgnored |
inherited_from |
\Formagic_Item_Input::$$_isIgnored |
Determines if item content can be edited.
$_isReadonly : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_isReadonly |
inherited_from |
\Formagic_Item_Input::$$_isReadonly |
Form item label
$_label : boolean
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_label |
inherited_from |
\Formagic_Item_Input::$$_label |
Form item name
$_name : string
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_name |
inherited_from |
\Formagic_Item_Input::$$_name |
Array of required attributes for this item
$_requiredAttributes : array
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_requiredAttributes |
inherited_from |
\Formagic_Item_Input::$$_requiredAttributes |
Array of rule object that are applied for this item
$_rules : array
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_rules |
inherited_from |
\Formagic_Item_Input::$$_rules |
Item value
$_value : mixed
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_value |
inherited_from |
\Formagic_Item_Input::$$_value |
Filtered item value cache
$_filteredValue : mixed
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_filteredValue |
inherited_from |
\Formagic_Item_Input::$$_filteredValue |
Violated rule after validation
$_violatedRules : \Form_Rule_Abstract
Inherited
inherited_from |
\Formagic_Item_Abstract::$$_violatedRules |
inherited_from |
\Formagic_Item_Input::$$_violatedRules |