| category |
Formagic |
| package |
Item |
| author |
Florian Sonnenburg |
| copyright |
Copyright (c) 2007-2009 Florian Sonnenburg |
| version |
$Id: Checkbox.php 160 2012-04-02 20:18:14Z meweasle $ |
Methods
Constructor
__construct(string $name, array $arguments) : void
Inherited
| inherited_from |
\Formagic_Item_Abstract::__construct() |
Parameters
$arguments
arrayAdditional arguments
Exceptions
Returns the HTML string representation of the form item.
__toString() : string
Inherited
| inherited_from |
\Formagic_Item_Abstract::__toString() |
Returns
stringThe 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() |
Parameters
$name
stringAttribute name
$value
stringAttribute 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() |
Parameters
$filter
mixedFilter type string or Formagic_Filter_Interface object.
$args
arrayOptional 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() |
Parameters
$rule
mixedRule type string or Formagic_Rule_Abstract object.
$args
arrayOptional 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() |
Parameters
$name
stringName of the attribute value to fetch
Returns
stringAttribute 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() |
Returns
arrayThe attributes array.
Returns HTML representation of checkbox item.
getHtml() : string
Should be overwritten by subclasses.
Returns
string
Returns label for this item.
getLabel() : string
Inherited
| inherited_from |
\Formagic_Item_Abstract::getLabel() |
Returns
stringThe label string.
Returns the item name.
getName() : string
Inherited
| inherited_from |
\Formagic_Item_Abstract::getName() |
Returns
stringThe item name
Returns current unfiltered value for this item.
getUnfilteredValue() : mixed
Inherited
| inherited_from |
\Formagic_Item_Abstract::getUnfilteredValue() |
Returns
mixedThe unfiltered item value
Returns the current filtered value for this item.
getValue() : mixed
Inherited
| inherited_from |
\Formagic_Item_Abstract::getValue() |
Returns
mixedThe 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() |
Returns
arrayThe violated rules.
Checks if a specific filter is defined for a Formagic item.
hasFilter(string $filterName) : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::hasFilter() |
Parameters
$filterName
stringFilter name
Returns
booleanCheck 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() |
Parameters
$ruleName
stringRule name, eg. 'Mandatory'
Returns
boolean
Returns disabled status of item
isDisabled() : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::isDisabled() |
Returns
booleanThe disabled status.
Returns hidden status of item
isHidden() : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::isHidden() |
Returns
booleanThe hidden status.
Returns ignore status of item
isIgnored() : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::isIgnored() |
Returns
booleanThe ignored status.
Prints item infos.
printInfo() : string
Inherited
| inherited_from |
\Formagic_Item_Abstract::printInfo() |
Returns
stringThe 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() |
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() |
Parameters
$flag
booleanDefined 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() |
Parameters
$flag
booleanIsFixed 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() |
Parameters
$flag
booleanHidden 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() |
Parameters
$flag
booleanIgnored status flag.
Returns
Sets readonly flag
setReadonly(boolean $flag) : \Formagic_Item_Abstract
Inherited
Implements a fluent interface pattern.
| inherited_from |
\Formagic_Item_Abstract::setReadonly() |
Parameters
$flag
booleanReadonly 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() |
Parameters
$requiredAttributes
arrayNumeric 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() |
Parameters
$value
mixedThe 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() |
Returns
booleanThe validation result.
Assembles attribute string in HTML-conform style
_buildAttributeStr(array $attributes) : string
Inherited
| inherited_from |
\Formagic_Item_Abstract::_buildAttributeStr() |
Parameters
$attributes
arrayarray of attributes
Returns
stringAttributes string
Filters a value
_filterValue(Formagic_Filter_Interface $filter, mixed $subject) : mixed
Inherited
| inherited_from |
\Formagic_Item_Abstract::_filterValue() |
Parameters
$subject
mixedScalar or array
Returns
mixedFiltered scalar or array
Allow subclass initialization.
_init(array $additionalArgs) : void
Inherited
| inherited_from |
\Formagic_Item_Abstract::_init() |
Parameters
$additionalArgs
arrayArray 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() |
Parameters
$subject
stringarrayValidation subject
Returns
booleanValidation result
Takes a string and returns a valid DOM ID.
_makeDomId(string $str) : string
Inherited
| inherited_from |
\Formagic_Item_Abstract::_makeDomId() |
Parameters
$str
stringString to convert to a DOM ID
Returns
stringValid DOM ID
Properties
Additional attributes for item HTML tag
$_attributes : array
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_attributes |
Array of input filters for this item
$_filters : array
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_filters |
Determines if item is removed from Formagic form.
$_isDisabled : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_isDisabled |
Determines if value can be changed.
$_isFixed : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_isFixed |
Determines if item will be displayed
$_isHidden : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_isHidden |
Determines if item content should be interpreted after submit.
$_isIgnored : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_isIgnored |
Determines if item content can be edited.
$_isReadonly : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_isReadonly |
Form item label
$_label : boolean
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_label |
Form item name
$_name : string
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_name |
Array of required attributes for this item
$_requiredAttributes : array
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_requiredAttributes |
Array of rule object that are applied for this item
$_rules : array
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_rules |
Item value
$_value : mixed
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_value |
Filtered item value cache
$_filteredValue : mixed
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_filteredValue |
Violated rule after validation
$_violatedRules : \Form_Rule_Abstract
Inherited
| inherited_from |
\Formagic_Item_Abstract::$$_violatedRules |