Formagic Renderer Xhtml

category Formagic
package Renderer
author Florian Sonnenburg
copyright Copyright (c) 2007-2011 Florian Sonnenburg
version $Id: Xhtml.php 160 2012-04-02 20:18:14Z meweasle $

 Methods

Constructor

__construct(Formagic_Translator $translator) 

Parameters

$translator

\Formagic_Translator

Translator object

Returns container label template.

getContainerLabelTemplate(string | \Formagic_Item_Container $container) : string
Inherited

inherited_from \Formagic_Renderer_Html::getContainerLabelTemplate()

Parameters

$container

string\Formagic_Item_Container

Optional. Returns a template defined for one specific container.

Returns

stringTemplate string

Returns the template for rows that hold sub-containers.

getContainerRowTemplate(string | \Formagic_Item_Container $container) : string
Inherited

inherited_from \Formagic_Renderer_Html::getContainerRowTemplate()

Parameters

$container

string\Formagic_Item_Container

Optional. Returns a template defined for one specific container.

Returns

stringTemplate string

Returns wrapper template for containers.

getContainerWrapperTemplate(string $container) : string
Inherited

inherited_from \Formagic_Renderer_Html::getContainerWrapperTemplate()

Parameters

$container

string

Optional. Returns a template defined for one specific item with name $name.

Returns

stringTemplate string

Returns form wrapper tag.

getFormWrapperTemplate() : string
Inherited

inherited_from \Formagic_Renderer_Html::getFormWrapperTemplate()

Returns

stringTemplate string

Returns single error message template

getItemErrorTemplate(string | \Formagic_Item_Abstract $item) : string
Inherited

inherited_from \Formagic_Renderer_Html::getItemErrorTemplate()

Parameters

$item

string\Formagic_Item_Abstract

Optional. Returns a template defined for one specific item.

Returns

stringTemplate string

Returns error wrapper template for item errors.

getItemErrorWrapperTemplate(string | \Formagic_Item_Abstract $item) : string
Inherited

inherited_from \Formagic_Renderer_Html::getItemErrorWrapperTemplate()

Parameters

$item

string\Formagic_Item_Abstract

Optional. Returns a template defined for one specific item.

Returns

stringTemplate string

Returns label template for an item.

getItemLabelTemplate(string | \Formagic_Item_Abstract $item) : string
Inherited

inherited_from \Formagic_Renderer_Html::getItemLabelTemplate()

Parameters

$item

string\Formagic_Item_Abstract

Optional. Returns a template defined for one specific item.

Returns

stringTemplate string

Returns item row template.

getItemRowTemplate(string | \Formagic_Item_Abstract $item) : string
Inherited

inherited_from \Formagic_Renderer_Html::getItemRowTemplate()

Parameters

$item

string\Formagic_Item_Abstract

Optional. Returns a template defined for one specific item.

Returns

stringTemplate string

Returns marker string for items marked as mandatory.

getMandatoryMarkerTemplate(string | \Formagic_Item_Abstract $item) : string
Inherited

inherited_from \Formagic_Renderer_Html::getMandatoryMarkerTemplate()

Parameters

$item

string\Formagic_Item_Abstract

Optional. Returns a template defined for one specific item.

Returns

stringTemplate string

Returns current translator instance.

getTranslator() : \Formagic_Translator
Inherited

inherited_from \Formagic_Renderer_Html::getTranslator()

Returns

\Formagic_TranslatorTranslator object

Returns form HTML string

render(Formagic $form) : string
Inherited

inherited_from \Formagic_Renderer_Html::render()

Parameters

$form

\Formagic

Formagic object to be rendered.

Returns

stringThe rendered HTML string

Sets container label template (empty by default).

setContainerLabelTemplate(string $template, string | \Formagic_Item_Container $container) : \Formagic_Renderer_Html
Inherited

Available placeholders: - %LABEL%: Label string

see \setContainerWrapperTemplate()
see \setContainerRowTemplate()
inherited_from \Formagic_Renderer_Html::setContainerLabelTemplate()

Parameters

$template

string

Template string

$container

string\Formagic_Item_Container

Optional. Defines this template only for a specific container (name or container object).

Returns

\Formagic_Renderer_HtmlFluent interface

Sets new template for rows that hold sub-containers (tr/td tags by default).

setContainerRowTemplate(string $template, string | \Formagic_Item_Container $container) : \Formagic_Renderer_Html
Inherited

Supported placeholders: - %CONTAINER%: HTML for the subcontainer, including it's wrapper

see \setContainerLabelTemplate()
see \setContainerWrapperTemplate()
inherited_from \Formagic_Renderer_Html::setContainerRowTemplate()

Parameters

$template

string

Template string

$container

string\Formagic_Item_Container

Optional. Defines this template only for a specific container.

Returns

\Formagic_Renderer_HtmlFluent interface

Sets wrapper template for containers (opening/closing table tag by default).

setContainerWrapperTemplate(string $template, string | \Formagic_Item_Container $container) : \Formagic_Renderer_Html
Inherited

Available placeholders: - %ROWS%: Rendered rows as HTML, including row wrapper - %ATTRIBUTES%: Assembled attributes string as HTML - %LABEL%: Rendered container label as HTML

see \setContainerLabelTemplate()
see \setContainerRowTemplate()
inherited_from \Formagic_Renderer_Html::setContainerWrapperTemplate()

Parameters

$template

string

Template string

$container

string\Formagic_Item_Container

Optional. Defines this template only for a specific container.

Returns

\Formagic_Renderer_HtmlFluent interface

Sets error CSS class.

setErrorClass(string $errorClass) : \Formagic_Renderer_Html
Inherited

This css class is per default added to the label and error list tag of items that did not pass validation.

inherited_from \Formagic_Renderer_Html::setErrorClass()

Parameters

$errorClass

string

New error class

Returns

\Formagic_Renderer_HtmlFluent interface

Sets form wrapper template (opening/closing form tag by default).

setFormWrapperTemplate(string $template) : \Formagic_Renderer_Html
Inherited

Available placeholders: - %ACTION%: Form action string - %METHOD%: Form method string - %ATTRIBUTES%: Assembled tag attributes string - %HIDDENS%: Rendered hidden inputs - %CONTAINER%: Rendered HTML of item holder container

inherited_from \Formagic_Renderer_Html::setFormWrapperTemplate()

Parameters

$template

string

Template string

Returns

\Formagic_Renderer_HtmlFluent interface

Sets a new template for a single error message (HTML LI tag by default)

setItemErrorTemplate(string $template, string | \Formagic_Item_Abstract $item) : \Formagic_Renderer_Html
Inherited

Available placeholders: - %ERRORMESSAGE%: Message string returned by violated rule

inherited_from \Formagic_Renderer_Html::setItemErrorTemplate()

Parameters

$template

string

Template string

$item

string\Formagic_Item_Abstract

Optional. Defines this template only for a specific item (name or item object).

Returns

\Formagic_Renderer_HtmlFluent interface

Sets error wrapper template (opening and closing list tags by default).

setItemErrorWrapperTemplate(string $template, string | \Formagic_Item_Abstract $item) : \Formagic_Renderer_Html
Inherited

Supported placeholders: - %ERRORS%: Rendered list of item errors

inherited_from \Formagic_Renderer_Html::setItemErrorWrapperTemplate()

Parameters

$template

string

Template string

$item

string\Formagic_Item_Abstract

Optional. Defines this template only for a specific item (name or item object).

Returns

\Formagic_Renderer_HtmlFluent interface

Sets label template for a single item (label tag by default).

setItemLabelTemplate(string $template, string | \Formagic_Item_Abstract $item) : \Formagic_Renderer_Html
Inherited

Available placeholders: - %LABEL%: Label string defined for item - %ID%: Value of Item's HTML ID attribute - %MANDATORYMARKER%: Marker for items with mandatory rule

see \setItemRowTemplate()
inherited_from \Formagic_Renderer_Html::setItemLabelTemplate()

Parameters

$template

string

Template string

$item

string\Formagic_Item_Abstract

Optional. Defines this template only for a specific item (name or item object).

Returns

\Formagic_Renderer_HtmlFluent interface

Sets template for rows containing input items (tr/td tags by default).

setItemRowTemplate(string $template, string | \Formagic_Item_Abstract $item) : \Formagic_Renderer_Html
Inherited

Available placeholders: - %LABEL%: Item label string - %ERROR%: Assembled error list (HTML) - %ERRORCLASS%: CSS class attribute with error class (eg. ' class="formagicError"') - %INPUT%: Input HTML

see \setItemLabelTemplate()
see \setItemErrorTemplate()
inherited_from \Formagic_Renderer_Html::setItemRowTemplate()

Parameters

$template

string

Template string

$item

string\Formagic_Item_Abstract

Optional. Defines this template only for a specific item (name or item object).

Returns

\Formagic_Renderer_HtmlFluent interface

Sets marker string for items that are marked mandatory (asterisk by default).

setMandatoryMarkerTemplate(string $template, string | \Formagic_Item_Abstract $item) : \Formagic_Renderer_Html
Inherited

inherited_from \Formagic_Renderer_Html::setMandatoryMarkerTemplate()

Parameters

$template

string

Template string

$item

string\Formagic_Item_Abstract

Optional. Item this template is to be defined for.

Returns

\Formagic_Renderer_HtmlFluent interface

Adds hidden fields to form HTML string.

_addHiddenItem(Formagic_Item_Hidden $item) 
Inherited

inherited_from \Formagic_Renderer_Html::_addHiddenItem()

Parameters

$item

\Formagic_Item_Hidden

Hidden item to be rendered.

Renders a container label into the container label template.

_getContainerLabel(Formagic_Item_Container $container) : string
Inherited

Returns empty string if no container label is defined.

inherited_from \Formagic_Renderer_Html::_getContainerLabel()

Parameters

$container

\Formagic_Item_Container

Container item

Returns

stringContainer label and template string

Returns the rendered error list and HTML class attribute.

_getErrorProperties(Formagic_Item_Abstract $item) : array
Inherited

Returns empty array if item validated ok.

inherited_from \Formagic_Renderer_Html::_getErrorProperties()

Parameters

Returns

arrayError list and class attribute. Example: array( '
  • Please enter a value.
', ' class="formagicError"')

Returns rendered item label and template.

_getItemLabel(Formagic_Item_Abstract $item) : string
Inherited

Returns a non-breakin-space HTML entity if no item label is provided.

inherited_from \Formagic_Renderer_Html::_getItemLabel()

Parameters

$item

\Formagic_Item_Abstract

Input item

Returns

stringItem label and template

Returns HTML for all items of a container (recursively)

_renderContainer(Formagic_Item_Container $container) : string
Inherited

inherited_from \Formagic_Renderer_Html::_renderContainer()

Parameters

$container

\Formagic_Item_Container

Container to be rendererd

Returns

stringHTML string

Sets a template string for an item to a template pool.

_setTemplate(array $templateArray, string $template, string | \Formagic_Item_Abstract $item) 
Inherited

inherited_from \Formagic_Renderer_Html::_setTemplate()

Parameters

$templateArray

array

Template pool new template is to be added to

$template

string

New template string

Returns a template for a specific item from a template array.

_getTemplate(array $templateArray, string | \Formagic_Item_Abstract $item) : string
Inherited

inherited_from \Formagic_Renderer_Html::_getTemplate()

Parameters

$templateArray

array

Pool of templates to choose from.

Returns

stringTemplate string

 Properties

 

Container label template array

$_containerLabelTemplate : array
Inherited

inherited_from \Formagic_Renderer_Html::$$_containerLabelTemplate
 

Template for rows containing containers

$_containerRowTemplate : array
Inherited

inherited_from \Formagic_Renderer_Html::$$_containerRowTemplate
 

Container wrapping template array

$_containerWrapperTemplate : array
Inherited

inherited_from \Formagic_Renderer_Html::$$_containerWrapperTemplate
 

Error class name

$_errorClass : string
Inherited

inherited_from \Formagic_Renderer_Html::$$_errorClass
 

Form wrapping template array

$_formWrapperTemplate : array
Inherited

inherited_from \Formagic_Renderer_Html::$$_formWrapperTemplate
 

Hidden inputs string

$_hiddenString : string
Inherited

inherited_from \Formagic_Renderer_Html::$$_hiddenString
 

Array of templates for displaying the item error string (list elements)

$_itemErrorTemplate : array
Inherited

inherited_from \Formagic_Renderer_Html::$$_itemErrorTemplate
 

Array of templates for item's error wrapper (list open tag)

$_itemErrorWrapperTemplate : array
Inherited

inherited_from \Formagic_Renderer_Html::$$_itemErrorWrapperTemplate
 

Template for displaying the item label array

$_itemLabelTemplate : array
Inherited

inherited_from \Formagic_Renderer_Html::$$_itemLabelTemplate
 

Template for rows containing normal items array

$_itemRowTemplate : array
Inherited

inherited_from \Formagic_Renderer_Html::$$_itemRowTemplate
 

HTML string for mandatory fields array

$_mandatoryMarkerTemplate : array
Inherited

inherited_from \Formagic_Renderer_Html::$$_mandatoryMarkerTemplate
 

Translator object

$_translator : \Formagic_Translator
Inherited

inherited_from \Formagic_Renderer_Html::$$_translator