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
stringMethod name string.
arrayArray of method parameters.
\Formagic_Exception |
if called method is not found in item holder |
|---|
mixedThe container method result.__construct(array $options = null)
arrayArray of options for the form.
\Formagic_Exception |
|---|
__get(string $itemName) : \Formagic_Item_Abstract
stringName of requested member.
\Formagic_Exception |
|---|
\Formagic_Item_AbstractItem object__set(string $key, mixed $value) : void
stringMember name
mixedMember value
\Formagic_Exception |
|---|
__toString() : string
stringThe 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
stringItem type string
stringItem name
arrayItem options array
\Formagic_Exception |
if item class not found |
|---|
\Formagic_Item_AbstractNew item instancegetFormAction() : string
stringForm action stringgetInfo() : string
stringThe form information string.getItemHolder() : \Formagic_Item_Container
\Formagic_Item_ContainerItem holder itemgetMethod() : string
stringThe form submit method.getName() : string
stringgetRaw() : array
arrayValues arraygetRenderer() : \Formagic_Renderer_Interface
\Formagic_Renderer_InterfaceThe renderer objectgetTrackSubmission() : boolean
booleanSubmission tracking status.getTranslator() : \Formagic_Translator_Interface
If no translator is specified, an empty translator object is returned.
\Formagic_Translator_InterfaceThe translator objectgetValues() : array
arrayArray of form item valuesisSubmitted() : boolean
Check result is true for following rules:
booleanSubmission statusrender() : string
Loads renderer class and calls renderer::fetch()
stringRenderer resultsetFormAction(string $value) : \Formagic
stringForm action URL
\Formagic_Exception |
if action value is not a string |
|---|
\FormagicFluent interfacesetMethod(string $method) : \Formagic
stringThe new form submit method
\Formagic_Exception |
if method is not supported |
|---|
\FormagicFluent interfacesetName(string $name) : \Formagic
string
\FormagicFluent interfacesetRenderer(string|\Formagic_Renderer_Interface $renderer) : \Formagic
string\Formagic_Renderer_InterfaceFormagic_Renderer object or string with name of renderer class
\Formagic_Exception |
if renderer is invalid |
|---|
\FormagicFluent interfacesetTrackSubmission(boolean $flag) : \Formagic
booleanTrack submission status
\FormagicFluent 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)'.
arrayobject\Formagic_Translator_InterfaceOne of the following:
\FormagicFluent interfacesetValues(array $values) : \Formagic
arrayForm values
\FormagicFluent 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 |
|---|
booleanValidation result_setOptions(array $options) : void
arrayArray of Formagic options
\Formagic_Exception |
If an option is not supported. |
|---|
_getTrackSubmissionItem() : \Formagic_Item_Hidden
\Formagic_Item_HiddenTrack 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
trueAPI_VERSION = '2.5'
VERSION = '1.5.3'