Formagic main class
Highly extensible form-generator with various rendering options, form validation and sanitation support.
You can use the following options when creating a formagic instance:
package | Formagic |
---|---|
author | Florian Sonnenburg |
since | 0.1.0 First time introduced |
__call(string $method, array $args) : mixed
string
Method name string.
array
Array of method parameters.
\Formagic_Exception |
if called method is not found in item holder |
---|
mixed
The container method result.__construct(array $options = null
)
array
Array of options for the form.
\Formagic_Exception |
---|
__get(string $itemName) : \Formagic_Item_Abstract
string
Name of requested member.
\Formagic_Exception |
---|
\Formagic_Item_Abstract
Item object__set(string $key, mixed $value) : void
string
Member name
mixed
Member value
\Formagic_Exception |
---|
__toString() : string
string
The rendering result._init() : void
createItem(string $type, string $name, array $args = array()
) : \Formagic_Item_Abstract
Tries to load correct object class and creates new object. Returns object if successful, throws Formagic_Exception if not
string
Item type string
string
Item name
array
Item options array
\Formagic_Exception |
if item class not found |
---|
\Formagic_Item_Abstract
New item instancegetFormAction() : string
string
Form action stringgetInfo() : string
string
The form information string.getItemHolder() : \Formagic_Item_Container
\Formagic_Item_Container
Item holder itemgetMethod() : string
string
The form submit method.getName() : string
string
getRaw() : array
array
Values arraygetRenderer() : \Formagic_Renderer_Interface
\Formagic_Renderer_Interface
The renderer objectgetTrackSubmission() : boolean
boolean
Submission tracking status.getTranslator() : \Formagic_Translator_Interface
If no translator is specified, an empty translator object is returned.
\Formagic_Translator_Interface
The translator objectgetValues() : array
array
Array of form item valuesisSubmitted() : boolean
Check result is true for following rules:
boolean
Submission statusrender() : string
Loads renderer class and calls renderer::fetch()
string
Renderer resultsetFormAction(string $value) : \Formagic
string
Form action URL
\Formagic_Exception |
if action value is not a string |
---|
\Formagic
Fluent interfacesetMethod(string $method) : \Formagic
string
The new form submit method
\Formagic_Exception |
if method is not supported |
---|
\Formagic
Fluent interfacesetName(string $name) : \Formagic
string
\Formagic
Fluent interfacesetRenderer(string|\Formagic_Renderer_Interface $renderer) : \Formagic
string
\Formagic_Renderer_Interface
Formagic_Renderer object or string with name of renderer class
\Formagic_Exception |
if renderer is invalid |
---|
\Formagic
Fluent interfacesetTrackSubmission(boolean $flag) : \Formagic
boolean
Track submission status
\Formagic
Fluent interfacesetTranslator(array|object|\Formagic_Translator_Interface $translatorDefinition = null
) : \Formagic
$translator has to be either an array with two members, the first one being the translator object and the second one the name of the translator method, or a translator object. In the latter case the translator method is assumed '$translatorObject->_($string)'.
array
object
\Formagic_Translator_Interface
One of the following:
\Formagic
Fluent interfacesetValues(array $values) : \Formagic
array
Form values
\Formagic
Fluent interfacevalidate() : boolean
Iterates through all items added to the form. If any rule is violated, iteration is stopped. Returns true if no rules are violated. The result of validate() is cached.
todo | Think of a better solution for setValues() in line 611 |
---|
boolean
Validation result_setOptions(array $options) : void
array
Array of Formagic options
\Formagic_Exception |
If an option is not supported. |
---|
_getTrackSubmissionItem() : \Formagic_Item_Hidden
\Formagic_Item_Hidden
Track submission item$_method : string
'post'
$_submitValues : array
array()
$_supportedMethods : array
array('get', 'post')
$_translator : \Formagic_Translator_Interface
$_formAction : string
$_itemHolder : \Formagic_Item_Container
$_name : string
'formagic'
$_submissionItem : \Formagic_Item_Hidden
$_trackSubmission : boolean
true
API_VERSION = '2.5'
VERSION = '1.5.3'